using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace _08
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
label2.ForeColor = Color.Black;
label2.Text = "" + i;
timer1.Interval = 1000;
}
int i = 10;
private void timer1_Tick(object sender, EventArgs e)
{
if (i <= 4)
{
label2.ForeColor = Color.Red;
}
if (i > 0)
{
i--;
label2.Text = "" + i;
}
}
private void button1_Click(object sender, EventArgs e)
{
if (timer1.Enabled == true)
{
timer1.Stop();
}
else
{
timer1.Start();
}
}
private void button2_Click(object sender, EventArgs e)
{
i = 10;
label2.Text = "" + i;
timer1.Stop();
}
}
}