Click here to Skip to main content
15,889,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
im doing a puzzlegame by using imagelist now,i stay this step since a long time . i will be grateful if someone can answer me.thanks


What I have tried:

if picturebox1.image = imagelist.images(1) ` not work...
Posted
Updated 1-Jan-18 23:30pm
Comments
Richard MacCutchan 25-Dec-17 3:20am    
Unless the two references point to the exact same object that will never work.
Nakhia_ind 26-Dec-17 9:57am    
sir the bellow code may work

MemoryStream imageStream1=new MemoryStream(), imageStream2=new MemoryStream();
Image img1 = pic1.Image;
Image img2 = pic2.Image;
byte[] imageContent1 = new Byte[imageStream1.Length];//Declare a byte array to hold byes read from stream
imageStream1.Position = 0; //set the stream position to start
imageStream1.Read(imageContent1, 0, (int)imageStream1.Length);// load the byte array with the image

byte[] imageContent2 = new Byte[imageStream2.Length];
imageStream2.Position = 0;
imageStream2.Read(imageContent2, 0, (int)imageStream2.Length);
bool equal = true;

if (imageStream1.Length == imageStream2.Length)
for (int i = 0; i < imageContent1.Length; i++)
{
if (imageContent1[i] != imageContent2[i])
{
equal = false;
break;
}
}
else
equal = false;

if (equal)
MessageBox.Show("Equal");
else
MessageBox.Show("Not Equal");

1 solution

 
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