timer控件不施行
timer控件不执行C# codeprivate void Lx(){timer1.Enabled truetimer1.Start()}private void timer1_T
timer控件不执行
C# code private void Lx() { timer1.Enabled = true; timer1.Start(); } private void timer1_Tick(object sender, EventArgs e) { string bmpPath =root + "\\" + WorkHelper.Czp_NO.Trim()+"\\bmps"; if (!Directory.Exists(bmpPath)) { Directory.CreateDirectory(bmpPath); } Screenshot.CutScreenAndSave(bmpPath); }
[解决办法]你单步执行确实执行到了Lx()?
[解决办法]自己创建一个线程用来做timer做的事,
调用的方法内部
{
while(true)
{
//你要做的事
Thread.Sleep(时间间隔);
}
}
[解决办法]你是在线程里面做的Timer吗??
在那个.cs里面。。把原来的那个System...Timer 改成 Thread.timer....具体百度下,我也不是很记得了,不过做过这东东!
[解决办法]timer控件是在ui线程运行的,跨线程调用timer控件会有问题!