winfrom程序,不能用线程,因为控件不支持。
让程序等待10秒后继续执行。
我的方法,肯定是行不通啦,timer3_Tick根本不执行。就无限循环在while里了。
public bool IsTime = true;
private void waitTimes()
{
timer3.Interval = 10000;
timer3.Start();
while (IsTime)
{
}
timer3.Stop();
IsTime = true;
} private void timer3_Tick(object sender, EventArgs e)
{
IsTime = false;
}
让程序等待10秒后继续执行。
我的方法,肯定是行不通啦,timer3_Tick根本不执行。就无限循环在while里了。
public bool IsTime = true;
private void waitTimes()
{
timer3.Interval = 10000;
timer3.Start();
while (IsTime)
{
}
timer3.Stop();
IsTime = true;
} private void timer3_Tick(object sender, EventArgs e)
{
IsTime = false;
}
那么根据这个特定事件中的标记去触发完全就可以啊 不用用timer控件的
Thread.sleep(10);
Applictaion.DoEvents();
就好了。
不管男人女人,都一样
ThreadPool.RegisterWaitForSingleObject 也可以设计延时;--这个是等待信号
System.Thread.Timer可以设置延时10s后执行;--只是构造器的设置
WaitHandle也可以 --等待信号量
在timer里,计时到了,再执行第二个函数
Thread.sleep(10);
Applictaion.DoEvents();
{
timer3.Interval = 10000;
timer3.Start();
打开几个页面
} private void timer3_Tick(object sender, EventArgs e)
{
页面打开后要做的事
}