【发布时间】:2013-11-09 23:52:34
【问题描述】:
如何更改超时按钮的文本?我尝试了以下代码,但它不起作用。
private void button1_Click(object sender, EventArgs e)
{
Stopwatch sw = new Stopwatch();
sw.Start();
if (button1.Text == "Start")
{
//do something
button1.Text = "stop"
if (sw.ElapsedMilliseconds > 5000)
{
button1.Text = "Start";
}
}
如何更正我的代码?
【问题讨论】:
-
我认为您必须为此设置 Timer...
标签: c# .net winforms timer timeout