Hello guys. I have queries, i made a matrix of Buttons and another of Panels and everythings is ok, that works. There is the code:
private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
{
ci = i;
cj = j;
M[i, j] = new Button();
panel1.Controls.Add(M[i, j]);
this.M[i, j].Location = new Point(10 + i * 100, 10 + j * 100);
this.M[i, j].Size = new Size(80, 80);
P[i, j] = new Panel();
panel1.Controls.Add(P[i, j]);
this.P[i, j].Location = new Point(10 + i * 100, 10 + j * 100);
this.P[i, j].Size = new Size(80, 80);
this.P[i, j].BackColor = Color.Red;
this.M[i, j].Click +=new EventHandler(ClickButton);
}
}
BUT, i want to make an event for Button which act on coresponding panel. So there is the problem.. I don't know how to do this.. I tried something but no change.
Anybody can help me? :(