int a, b;
private void Form1_Load(object sender, EventArgs e)
{
this.Width = 600;
this.Height = 436;
for (a = 1; a <= 8; a++)
{
for (b = 1; b <= 8; b++)
{
Button btn = new Button();
btn.Name = (((a - 1) * 8) + b).ToString();
btn.Width = 50;
btn.Height = 50;
btn.Left = (b - 1) * 50;
btn.Top = (a - 1) * 50;
if ((a + b) % 2 == 0)
btn.BackColor = Color.WhiteSmoke;
else
btn.BackColor = Color.Black;
btn.Click += new EventHandler(btn_Click);
this.Controls.Add(btn);
}
}
}
int i, j,y;
void btn_Click(object sender, EventArgs e)
{
Button btn = (Button)sender;
if (radioButton1.Checked == true)
{
i = int.Parse(btn.Name);
j = i % 8;
for (y = 1; y <= 8; j+=8)
{
}
}
how can i change other buttons backcolor?