Timer timer = new Timer(); List<Button> btns; int i = 0; public Form2() { InitializeComponent();
btns = new List<Button>(); foreach (Control con in this.Controls) { if (con is Button) { btns.Add(con as Button); } } i = btns.Count; timer.Interval = 5000; timer.Tick += new EventHandler(timer_Tick); timer.Start();
Timer timer = new Timer();
List<Button> btns;
int i = 0; public Form2()
{
InitializeComponent();
btns = new List<Button>();
foreach (Control con in this.Controls)
{
if (con is Button)
{
btns.Add(con as Button);
}
}
i = btns.Count;
timer.Interval = 5000;
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
} void timer_Tick(object sender, EventArgs e)
{
//throw new NotImplementedException(); btns[i - 1].ForeColor = Color.Red;
i--;
}