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 timer1_Tick(object sender, EventArgs e)
{
c++;
button1.Text = c.ToString();
button2.Text = c.ToString();
button3.Text = c.ToString();
if (c % 3 == 0)
{
button2.BackColor = System.Drawing.Color.White;
button1.BackColor = System.Drawing.Color.Red;
button3.BackColor = System.Drawing.Color.White;
}
else if (c % 3 == 1)
{
button2.BackColor = System.Drawing.Color.Yellow;
button1.BackColor = System.Drawing.Color.White;
button3.BackColor = System.Drawing.Color.White;
}
else if (c % 3 == 2)
{
button2.BackColor = System.Drawing.Color.White;
button1.BackColor = System.Drawing.Color.White;
button3.BackColor = System.Drawing.Color.Green;
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
沒有留言:
張貼留言