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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
//宣告
int i,j;
public Form1()
{
InitializeComponent();
i = 0;
}
private void timer1_Tick(object sender, EventArgs e)
{
button1.Enabled = false;//按鈕不能按
button2.Enabled = false;
button3.Enabled = false;
i++;
i = i % 5;//求餘數
label1.Text=Convert.ToString(i);
j++;
j = j % 5;
switch (j)
{
case 0:
button1.Enabled = true;//按鈕能按
break;
case 1:
button2.Enabled = true;
break;
case 2:
button3.Enabled = true;
break;
case 3:
button3.Enabled = true;
break;
case 4:
button3.Enabled = true;
break;
}
}
}
}
沒有留言:
張貼留言