Good day, I'm a beginner in programming and I want to create a simple chess game. I'm using windows forms in C#. I have no problem with declaring and initializing the array, but how do I set click events for each of the picureboxes? Before I was doing it in VS properties box. Here is my initializing code.
public void picbnox()
{
picturbox[0, 0] = new PictureBox();
picturbox[0, 0].Visible = true;
picturbox[0, 0].Location = new Point(15, 30);
picturbox[0, 0].Size = new Size(65, 65);
picturbox[0, 0].BorderStyle = BorderStyle.FixedSingle;
this.Controls.Add(picturbox[0, 0]);
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
{
picturbox[i, j] = new PictureBox();
picturbox[i, j].Visible = true;
picturbox[i, j].Location = new Point(i *70, j *70);
picturbox[i, j].Size = new Size(65, 65);
picturbox[i, j].BorderStyle = BorderStyle.FixedSingle;
this.Controls.Add(picturbox[i, j]);
}
}
}