Click here to Skip to main content
15,922,007 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am comparing the the image i stored in button.image with image from my resources folder

i am getting error "Operator '=' is not defined for types 'System.Drawing.Image' and 'Object'"

the images are .bmp format of plain color green

What method should i use to compare the 2 images to check for similarity

if button1.image=My.Resources.ResourceManager.GetObject("greenseat")then

'do something

Updated 16-May-13 2:06am

1 solution

The objects aren't equal and no comparator is available to handle it. Second, it isn't that easy because the image the button uses has lost the meta data, so it doesn't know where it came from. You could load the image from resource and compare the images. Some links are included. But I guess you want to simply check some state and act accordingly. In that case it would be best to keep track of state using an enum or numeric value. You can use that to show the image accordingly or handle whatever needs to be done at a certain state.

Comparing Images using[^]

Simple image comparison in .NET[^]

Good luck!
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900