一个关于秒表的问题
[localimg=274,105]3[/localimg]我写了以下这一段关于秒表的程序int x=0,ms=0;
private void timer1_Tick(object sender, System.EventArgs e)
{
if(this.timer1.Enabled==true)
{
if(ms<=100)
ms+=1;
else
ms=0; x=0;
}
this.textBox1.Text=x.ToString()+":"+ms.ToString();
}
private void button1_Click(object sender, System.EventArgs e)
{
if(this.timer1.Enabled==false)
{
this.timer1.Enabled=true;
this.button1.Text="停止";
}
else
{
this.timer1.Enabled=false;
this.button1.Text="启动";
}
}
private void button2_Click(object sender, System.EventArgs e)
{
this.timer1.Enabled=false;
x=0;ms=00;
}
private void Form1_Load(object sender, System.EventArgs e)
{
button1.Text="启动";
button2.Text="复位";
textBox1.Text="0:00";
timer1.Interval=10;
}
但出了一个错误,请帮我修改下.
以下附我的程序包,设计界面和错误.
[[it] 本帖最后由 meweiwei 于 2008-9-26 21:03 编辑 [/it]]
WindowsApplication5.rar
(23.28 KB)