Hi all,
I have a problem with PictureBoxes. I want use - Click on Picture Box (I have 8 picture boxes with different colors) and I want that the color from box when I click on write on other picture box.. I hope that you know what I mean this and sorry for my English..
Game MasterMind with PicureBoxes
10 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Hirendra SisodiyaRank #256 · 9.8K pointsPosted Mar 30, 2010, 6:38 AM EDT
thanks
Please mark as answere if it helps
Hirendra SisodiyaRank #256 · 9.8K pointsPosted Mar 29, 2010, 4:20 AM EDT
thanks
V7 pointsPosted Mar 29, 2010, 4:41 AM EDT
Hirendra SisodiyaRank #256 · 9.8K pointsPosted Mar 29, 2010, 11:35 PM EDT
we can do this by taking some array of controls, i have developed a sample application that behaves according you
please see attached WindowApplication1.zip application.
thanks
Please mark as answere if it helps
V7 pointsPosted Mar 30, 2010, 1:41 AM EDT
It helped me, thanks very much, but it doesn't work in my Project and I don't know what?! I upload my Project here.
Hirendra SisodiyaRank #256 · 9.8K pointsPosted Mar 30, 2010, 2:20 AM EDT
i checked your code,your buttons click event were not working,i have made changes about such things such as now i generate joint click event of Buttons of color palate.
now your application works fine, download it and test..
thanks
Please mark as answere if it helps
V7 pointsPosted Mar 30, 2010, 3:26 AM EDT
Color = Color.FromArgb( (rnd.Next(0,255)), (rnd.Next(0,255), ....... );
(rnd.Next(0,255)) );
or it is totally rubissh?
And button "Zpet" in translate is Back.. How can I implement one step back in choosing colors?
Hirendra SisodiyaRank #256 · 9.8K pointsPosted Mar 30, 2010, 4:24 AM EDT
you are right, you can choose random color like:
Random rnd =new Random();
Color clr = Color.FromArgb(rnd.Next(0,255),rnd.Next(0,255), rnd.Next(0,255));
and for going one step back replace this code on vyhodnotit_Click event:
if (count == 4)
{
count = 0;
}
and put this code on back_Click event:
Totalcount=Totalcount-1;
count=count-1;
if (count <= 3)
{
if (Totalcount >= 0 && Totalcount <= 3)
{
picBox_Set_1[count].BackColor = Color.White;
}
if (Totalcount >= 4 && Totalcount <= 7)
{
picBox_Set_2[count].BackColor = Color.White;
}
if (Totalcount >= 8 && Totalcount <= 11)
{
picBox_Set_3[count].BackColor = Color.White;
}
if (Totalcount >= 12 && Totalcount <= 15)
{
picBox_Set_4[count].BackColor = Color.White;
}
if (Totalcount >= 16 && Totalcount <= 19)
{
picBox_Set_5[count].BackColor = Color.White;
}
if (Totalcount >= 20 && Totalcount <= 23)
{
picBox_Set_6[count].BackColor = Color.White;
}
if (Totalcount >= 24 && Totalcount <= 27)
{
picBox_Set_7[count].BackColor = Color.White;
}
if (Totalcount >= 28 && Totalcount <= 31)
{
picBox_Set_8[count].BackColor = Color.White;
}
if (Totalcount >= 32 && Totalcount <= 35)
{
picBox_Set_9[count].BackColor = Color.White;
}
if (Totalcount >= 36 && Totalcount <= 39)
{
picBox_Set_10[count].BackColor = Color.White;
}
if (Totalcount >= 40 && Totalcount <= 43)
{
picBox_Set_10[count].BackColor = Color.White;
}
}
thanks
Please mark as answere if it helps
V7 pointsPosted Mar 30, 2010, 5:00 AM EDT
I appreciate your holpen!!
V7 pointsPosted May 11, 2010, 12:00 AM EDT
I have this code and I need: Click on button "Vyhodnotit" and the small pictureboxes fill with black and white color.. When you have color on same place as in auto generate line, first little picturebox fill in black color etc.. And If I find the same color as in auto generate line but the color will be wrong place, the little picturebox fill in white color.. (GAME MASTERMIND)
Could you help me with code? I tried this a long time but unsuccesfull :-(