此帖也是
http://community.csdn.net/Expert/topic/3842/3842298.xml?temp=.9785883System.Windows.Forms.Timer timer1;
我想知道我调用timer1.stop();时,当前正在执行的timer1_Tick是否会完整执行完.
我发现
1 、

this.timer1.Enabled = true;
等于用
this.timer1.Start();
2、

this.timer1.Enabled = false;
等于用
this.timer1.Stop();
不明白道理,效果是一样的。
我是说用
this.timer1.Enabled = true;
this.timer1.Enabled = false;
配套使用
和用
this.timer1.Start();
this.timer1.Stop();
配套使用
效果完全一样
都是不能完整执行完。

解决方案 »

  1.   

    timer_tick(sender,e)
    {
    timer.stop();
    messegebox.show("能执行完");
    }执行看看!呵呵!
      

  2.   

    楼上的我不苟同.
    你的timer.stop()是放在timer_tick中的。
    而不是他的外面。另外即便像你那样写,也不能证明timer_tick总是会执行完。
    经过我的测试,(把timer_stop放在timer_tick的外面,这是通常的方式)
    timer_tick经常是不能执行完。而当下一次timer1.start的时候才继续执行。
      

  3.   

    http://community.csdn.net/Expert/topic/3897/3897755.xml?temp=.7407953
    帮忙顶一下 我结帖
      

  4.   

    timer_tick(sender,e)
    {
    for(long i=0;i<1000000;i++);
    messegebox.show("能执行完");
    }
    private void button1_click(.....)
    {
        timer1.stop()
    }
    运行时在他没算完前 按button1不就知道了吗