C# 循环语句里如何实现暂停一段时间再继续执行,不能用Thread.Sleep(1000);
2个回答
展开全部
"可用timer控件,进行计时等待追问:能不能给下详细的代码 下面是我的代码 但是不对
private System.Timers.Timer timerClock;
private void button8_Click(object sender, System.EventArgs e)
{
while(day<27)
{
timerClock = new System.Timers.Timer();
timerClock.Elapsed += new ElapsedEventHandler(OnTimer);
timerClock.Interval = 3000;
timerClock.Enabled = true;
day++;
}
}
public void OnTimer(Object source, ElapsedEventArgs e)
{
}"
private System.Timers.Timer timerClock;
private void button8_Click(object sender, System.EventArgs e)
{
while(day<27)
{
timerClock = new System.Timers.Timer();
timerClock.Elapsed += new ElapsedEventHandler(OnTimer);
timerClock.Interval = 3000;
timerClock.Enabled = true;
day++;
}
}
public void OnTimer(Object source, ElapsedEventArgs e)
{
}"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询