X
Xarky
Hi,
I am creating an array of PictureBoxes on my Windows Form.
PictureBox temp;
PictureBox[10,10] myArea = new Picture
for (int x=0; x<10; x++)
{
for (int y=0; y<10; y++)
{
temp = new PictureBox();
temp.Location = new Point(1+(x*MAX), 1+(y*MAX));
temp.Size = new Size(MAX, MAX);
temp.BackColor = System.Drawing.Color.Green;
myArea[x, y] = temp;
myArea[x, y].Click +=new EventHandler(my_Click);
this.Controls.Add(temp);
}
}
private void my_Click(object sender, EventArgs e)
{
// now here I need to get the PictureBox which was clicked and do
some operations on it.
}
Can someone tell me how to get which picturebox was clicked?
Thanks in Advance for your help
I am creating an array of PictureBoxes on my Windows Form.
PictureBox temp;
PictureBox[10,10] myArea = new Picture
for (int x=0; x<10; x++)
{
for (int y=0; y<10; y++)
{
temp = new PictureBox();
temp.Location = new Point(1+(x*MAX), 1+(y*MAX));
temp.Size = new Size(MAX, MAX);
temp.BackColor = System.Drawing.Color.Green;
myArea[x, y] = temp;
myArea[x, y].Click +=new EventHandler(my_Click);
this.Controls.Add(temp);
}
}
private void my_Click(object sender, EventArgs e)
{
// now here I need to get the PictureBox which was clicked and do
some operations on it.
}
Can someone tell me how to get which picturebox was clicked?
Thanks in Advance for your help