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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top