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 ,d=4,f=0,g=2;
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
button1.Text = g.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
c = c + 1;
if (c <= 4)
{
button4.BackColor=System.Drawing.Color.FromName("Green");
d=d-1;
button4.Text = d.ToString();
}
else if (c <= 7)
{
button3.BackColor = System.Drawing.Color.FromName("Yellow");
button4.BackColor = System.Drawing.Color.FromName("White");
d=0;
button3.Text = d.ToString();
}
else if (c<=10)
{
button1.BackColor = System.Drawing.Color.FromName("Red");
button3.BackColor = System.Drawing.Color.FromName("White");
button1.Text = g.ToString();
g=g-1;
}
else
{
c = 0;
d = 4;
g = 2;
button1.BackColor = System.Drawing.Color.FromName("White");
button4.BackColor = System.Drawing.Color.FromName("Green");
}
}
}
}
沒有留言:
張貼留言