المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Comparing Two PictureBox



C# Programming
11-26-2009, 05:01 PM
Hello. I'm having some problems about comparing two pictureBox. I want the other one to be invisible when they have the same image but when I tried it didn't have any changes. How can I do that? Me and my groupmates are creating a game similar to mystery case files: prime suspect and I'm the one who is creating the two player mode. The purpose of making the visible property of the other pictureBox is to let the players know that they already found the image we're asking for them to find but until now I can't still do that. Please help me.

Here's the code I tried to use, this is just one of the pictureBox i want to compare to the other pictureBox:

private void picBoxRandom1_Click(object sender, EventArgs e)
{
if (picBoxPlayerOne1st.Image.Equals(picBoxRandom1.Image))
{
picBoxRandom1.Visible = false;
PlayerTwo();
}

if (picBoxPlayerTwo1st.Image.Equals(picBoxRandom1.Image))
{
picBoxRandom1.Visible = false;
PlayerOne();
}
}


picBoxPlayerOne1st is the pictureBox where the asked image is being shown while the picBoxRandom1 is the pictureBox where the right image is shown. Both pictureBox have random images.