Skip to content

Game MasterMind with PicureBoxes

V

Asked Mar 29, 2010, 1:09 AM EDTSolved
Share
LinkedInX
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..

10 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Hirendra Sisodiya
    ✓ Accepted answer0
    check this
    thanks
     
    Please mark as answere if it helps
    0
  • Hirendra Sisodiya
    0
    Please explain your question....
    thanks 
    0
  • 0
    I have Windows Form Application, it looks like this and I want something like this: I click for example on blue color and I want this color see in picturebox1, next click write next color (for example I click on red) to pictbox2 .... When I fill all 4 pictureboxes, I would click on button "Vyhodnotit" and begin write colors on next row (pictbox5, 6...). Could you help me, please?
    0
  • Hirendra Sisodiya
    0
    Hello V
    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
    0
  • 0
    Hi,
    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.
    0
  • Hirendra Sisodiya
    0
    Hello
    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
    0
  • 0
    So, it will works perfectly, but the first row should be automatic random generate color combination from this colors, can I write like this:

    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?
    0
  • Hirendra Sisodiya
    0
    Hello V
    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
    0
  • 0
    Yes I understand this code for Back_Click, but it doesn't work.. The code for automatic generate colors I don't understand.. And I don't know, what the colors are writing to first row too, I edit code, but maybe bad?

    I appreciate your holpen!!
    0
  • 0
    Hi,
    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 :-(
    0