using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
int c = 0
;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
c++;
button1.Text = c.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
c++;
if (c % 3 == 0)
{
button1.BackColor = Color.Red;
button2.BackColor = Color.Black;
button3.BackColor = Color.Black;
}
else if (c % 3 == 1)
{
button1.BackColor = Color.Black;
button2.BackColor = Color.Yellow;
button3.BackColor = Color.Black;
}
else if (c % 3 == 2)
{
button1.BackColor = Color.Black;
button2.BackColor = Color.Black;
button3.BackColor = Color.Green;
}
}
}
}
沒有留言:
張貼留言