Win32 Comparing Button.Images

  • Thread starter Thread starter - Steve -
  • Start date Start date
S

- Steve -

I've assigned three pictures as resources. So I can access them via
Resources.Image1, Resources.Image2, etc

On the buttons I try to do the following

if(Button1.Image == Resources.Image1)

or

if(Button1.Image.Equals(Resources.Image1))

It is always false though. How can I find out if a certain button is using
a certain picture or not?
 
Steve,

There is no easy way to do this. When you use the ==, it is comparing
the object references, in which case, they are not going to be the same (for
the most part).

If anything, you should use an identifier of some sort to indicate what
image is assigned. The only other alternative you have is to do a
comparison of the two images, which would be pretty intensive.

Hope this helps.
 
Back
Top