class keytest : Form
{
//在整个客户区显示文本
private Button btn1;
//手工编写定时器timer,实现间隔性在btn1按钮上显示flatstyle的枚举值
public keytest()
{
btn1 = new Button();
//btn1.Text = "&button1";
btn1.Size = new Size(btn1.Size.Width,btn1.Size.Height);
btn1.Parent = this;
//btn1.Location = new Point(ClientSize.Width/ 2, ClientSize.Height / 2);//
Timer t1 = new Timer();
t1.Interval = 10;
t1.Tick += new EventHandler(t1_Tick);//定时器每次触发引起的工作
t1.Start();//start启用定时器
btn1.Location = new Point(ClientSize.Width / 2, ClientSize.Height / 2);
}
protected void t1_Tick(object sender, EventArgs e)
{
Random r=new Random();
btn1.Text = r.Next(100).ToString();//random随机类,哈哈
}
public static void Main()
{
Application.Run(new keytest());
}
}