Member Avatar for Arturo32

It is possible to compare background images of a pictureBox?
This piece of code works?:

pictureBox8.BackgroundImage == pictureBox9.BackgroundImage

I ask bcause apparently, if used as this:

if(pictureBox8.BackgroundImage == pictureBox9.BackgroundImage)

the result of that IF sentence is always false

Recommended Answers

All 3 Replies

For most objects the == operation just compares if they are referencing the same object, it doesn't do a 'deep compare'. You'll have to write your own method that compares the images.

Member Avatar for Arturo32

For most objects the == operation just compares if they are referencing the same object, it doesn't do a 'deep compare'. You'll have to write your own method that compares the images.

+1 Momerath, well said. Arturo32, Take a look at Image comparison article.

Thank you Momerath, and thank you too adatapost for that article, you solve my doubt.
Thank you again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.