-------------------------------------------------------------
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int a, d = 0;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
d = d + 1;
a = d % 3;
if (a == 1)
{
button1.BackColor = Color.Green;
button2.BackColor = Color.Transparent;
button3.BackColor = Color.Transparent;
}
if (a == 2)
{
button2.BackColor = Color.Yellow;
button1.BackColor = Color.Transparent;
button3.BackColor = Color.Transparent;
}
if (a == 0)
{
button3.BackColor = Color.Red;
button1.BackColor = Color.Transparent;
button2.BackColor = Color.Transparent;
}
}
}
}
留言列表