按钮上的图片 [英] image on button

查看:85
本文介绍了按钮上的图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好
我有一个问题,我把图像按钮(EX:button1.image = image.fromfile( 1.bmp"))
那么我想将按钮上的图像与指定的图像进行比较,如果它们相等,则执行一个方法.
我不知道如何比较按钮上的图像和指定图像的代码?

谢谢:rose:

hello
I have a question ,i put a image on button(EX:button1.image=image.fromfile("1.bmp"))
then i want to compare image on button with a specified image that if they equal then a method executed.
i dont khow code for compare image on button and specified image?

thanks:rose:

推荐答案

所以您的问题与按钮无关,它是如何比较两个图像的?要比较它们是否是同一文件,请逐像素进行比较.您可以阅读我的图像处理文章,了解如何获取像素数据.如果它们是显示相同内容的不同文件,则确实是一项非常复杂的任务.
So your question has nothing to do with buttons, it is how do you compare two images ? To compare if they are the same file, do a pixel by pixel comparison. You can read my image processing articles for how to get the pixel data. If they are different files that show the same thing, is a very complex task indeed.


在我看来,这似乎是一项复杂的任务.您可以阅读图像处理文章

祝您好运
In my opinion it seems to be a complex task. You can read Image Processing articles

Good Luck


相反,您应该将其与一些文本/代码进行比较.您无法比较图像,它需要图像处理.否则,将其与图像名称进行比较.

但是后果很可能是可以更改图像名称而仍然包含相同的图像.

建议:用作按钮的关联标识符,以检查是否相等.
Rather you should be comparing with some text/code. You cannot compare an image, it requires image processing. Or else compare with the image names.

But the consequences are likely that the image name can be changed still containing the same image.

Recommendation: Use as associated identifier for the buttons to check equality.


这篇关于按钮上的图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆