本文介绍了[已解决]计时器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

早安,
我在计时器间隔中遇到问题,
不会根据我给它的时间间隔触发timer1_Tick事件!!!

我通过向导(拖放)创建了我的计时器,并在事件timer1_Tick中写道:

Good Day,
i''m facing a problem in the timer interval,
the timer1_Tick event is not fired according to the interval i''m giving it!!!

i created my timer by wizard(drag-drop), and in the event timer1_Tick i write:

private void timer1_Tick(object sender, EventArgs e)
        {
            Lbl_TimeLeft.Text = counter.ToString();
            counter = counter - 1;
        }


计数器被初始化为值为100的整数.
我为间隔指定了不同的值(10或10000毫秒),但未生效,标签仍在更改相同

10x


counter is initialized as integer with value 100.
i''m giving the interval different values (10 or 10000 millisecond) but it is not effected, the label is still changing the same

10x

推荐答案


int counter = 100;

       private void button1_Click(object sender, EventArgs e)
       {
           timer1.Enabled = true;
       }

       private void timer1_Tick(object sender, EventArgs e)
       {
           label1.Text = counter.ToString();
           counter = counter - 1;
       }


这篇关于[已解决]计时器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 06:29