计时器太慢......为什么? [英] timer too slow... why?

查看:383
本文介绍了计时器太慢......为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创造了一个愚蠢的动画。一个简单的标签,在我的表格边框上反弹

。动作由一个计时器来统治,该计时器设定每个步骤的时间。


如果我将间隔设置为1000。它运作正常,如果我把它设置为bb在10或者更少,它会比它更慢。


任何人都可以帮助我吗?

请原谅我的坏英语

谢谢< br $>
-

-Diego(Atos) -

-L''uomoèprofororeagli animali-

- Fanno eccezione il nano e la giraffa-

-A.Bergonzoni-

-Per rispondere in privato potare" POTA" dall''indirizzo-

I''ve create a "stupid" animation. A simple label that bounce on borders
of my form. Motion is ruled by a timer that set the timing of every
steps.

If I set the interval at "1000" it works properly, howevery if i set it
at "10" or less, it warks slower than it would be.

Anyone can help me?
Excuse my bad english
Thanks
--
-Diego (Atos)-
-L''uomo è superiore agli animali-
-Fanno eccezione il nano e la giraffa-
-A.Bergonzoni-
-Per rispondere in privato potare "POTA" dall''indirizzo-

推荐答案

您使用的是哪个计时器类?

System.WIndows.Forms.Timer

System.Threading.Timer

System.Timers.Timer


问候


理查德Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog


" Diego_Atos" <二******** @ POTAbigfoot.com>在留言中写道

新闻:MP ************************ @ news.tin.it ...
Which timer class are you using?
System.WIndows.Forms.Timer
System.Threading.Timer
System.Timers.Timer

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

"Diego_Atos" <di********@POTAbigfoot.com> wrote in message
news:MP************************@news.tin.it...
我创建了一个愚蠢的动画。一个简单的标签,反弹在我的表格的边界上。动作由定时器控制,定时器设定每个步骤的时间。

如果我将间隔设置为1000。它运作正常,如果我把它设置在10,它是多少。或者更少,它会比它更慢。

任何人都可以帮助我吗?

请原谅我糟糕的英语

谢谢
- -
-Diego(Atos) -
-L''uomoèuporeoreagli animali-
-Fanno eccezione il nano e la giraffa-
-A.Bergonzoni- -Per rispondere in privato potarePOTA dall''indirizzo -
I''ve create a "stupid" animation. A simple label that bounce on borders
of my form. Motion is ruled by a timer that set the timing of every
steps.

If I set the interval at "1000" it works properly, howevery if i set it
at "10" or less, it warks slower than it would be.

Anyone can help me?
Excuse my bad english
Thanks
--
-Diego (Atos)-
-L''uomo è superiore agli animali-
-Fanno eccezione il nano e la giraffa-
-A.Bergonzoni-
-Per rispondere in privato potare "POTA" dall''indirizzo-



你好Diego,


不保证执行计时器事件。如果程序繁忙,则在发送另一个计时器事件之前,计时器事件可能没有时间执行。然后取消第一个等待事件。实际上,将计时器设置为10可能看起来不会比将其设置为100更快。


丢弃的计时器事件会受到处理器速度,程序繁忙程度以及需要多长时间的影响执行计时器事件代码。


-

快乐编码!

Morten Wennevik [C#MVP]
Hi Diego,

The timer event is not guaranteed to execute. If your program is busy the timer event might not get time to execute before another timer event is sent. The first waiting event is then cancelled. In effect setting timer to 10 might not seem any faster than setting it to 100.

Dropped timer event is affected by your processor speed, how busy your program is, and how long it takes to execute the timer event code.

--
Happy coding!
Morten Wennevik [C# MVP]


Risposta a:

Richard Blewett(ri*****@dotnetconsult.co.uk)

_________________
Risposta a:
Richard Blewett (ri*****@dotnetconsult.co.uk)
_________________
System.Timers.Timer
System.Timers.Timer




这个

-

- 迭戈(阿托斯) -

-L''uomoèprioporeagli animali-

-Fanno eccezione il nano e la giraffa-

-A .Bergonzoni-

-Per risatodere in privato potare" POTA" dall''indirizzo-



this
--
-Diego (Atos)-
-L''uomo è superiore agli animali-
-Fanno eccezione il nano e la giraffa-
-A.Bergonzoni-
-Per rispondere in privato potare "POTA" dall''indirizzo-


这篇关于计时器太慢......为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆