Prasadi

Prasadi

  • NA
  • 1
  • 1.9k

How to load a different image to a picture box on click event

Nov 21 2012 5:34 AM
Hi,
Im developing a game using c sharp. For that i want to know how to change the default picture box image in to another image on click event. When the user click on the picture box should display another image. Then it should disable the picture box so no body else can click on it again.

this is the code i have done

private void Game_Logic(int tossnum)
        {
            bool flag = false;
            if (tossnum != 0)
            {
                if (this.pictureBox1.Click == true)
                {
                    pictureBox1.Image = new Bitmap("C:\\Users\\pchathurani\\Documents\\Visual studio My projects\\Game\\Game\\images\\player_one.png");
                    flag = true;
                }
                

            }
        }

Answers (1)