Torna al Thread
private PictureBox[,] scacchiera = new PictureBox[8, 8];
private void Form1_Load(object sender, EventArgs e)
{
bool white = true;
int size = 40;
for (int i = 0; i <= 7; i++)
{
for (int j = 0; j <= 7; j++)
{
scacchiera[i, j] = new PictureBox();
scacchiera[i, j].Name = j + "-" + i;
scacchiera[i, j].Location = new Point(j * size + size, 8 * size - i * size);
scacchiera[i, j].Size = new Size(size, size);
scacchiera[i, j].BackColor = (white) ? System.Drawing.Color.White : System.Drawing.Color.Black;
scacchiera[i, j].Click += new EventHandler(pctQuad_Click);
this.Controls.Add(scacchiera[i, j]);
white = !white;
}
white = !white;
}
}
private void pctQuad_Click(object sender, EventArgs e)
{
MessageBox.Show(((PictureBox)sender).Name);
}