One option would be to use the Tag
property... many classes have one, including Bitmap
, Image
, and PictureBox
. You could assign a unique value to each Image.Tag
...
var bmp = new Bitmap(1,1);
bmp.Tag = "uniqueTag";
pictureBox1.Image.Tag = bmp; // pictureBox1.Image.Tag == "uniqueTag"
... then check for equality:
if (pictureBox1.Image.Tag == pictureBox2.Image.Tag)
{
...
}