public partial class Form1 : Form
{
int c = 2, d = 0;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
c = c + 1;
button1.Text = c.ToString();
}
private void timer1_Tick(object sender, EventArgs e)
{
c = c + 1;
d = c % 3;
if (d == 0)
{
button1.BackColor = System.Drawing.Color.Red;
}
else
{
button1.BackColor = System.Drawing.Color.White;
}
if (d == 1)
{
button2.BackColor = System.Drawing.Color.Yellow;
}
else
{
button2.BackColor = System.Drawing.Color.White;
}
if (d == 2)
{
button3.BackColor = System.Drawing.Color.Green;
}
else
{
button3.BackColor = System.Drawing.Color.White;
}
}
}