带定时器的螺纹防溅板 [英] Threaded Splashscreen with Timer
本文介绍了带定时器的螺纹防溅板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Sub Main的线程上运行了一个启动画面,它运行正常。它
在状态栏中显示有关查询的信息。我也有时间在
启动画面上,但是tick事件永远不会被触发。在加载事件中如果
启动画面我调用了计时器的Start()事件。我是否可以获得点击事件
来解雇?
I have a splashscreen running on a thread from Sub Main and it works OK. It
displays information in a statusbar about queries. I also have a time on the
splashscreen, but the tick event never gets fired. In the Load Event if the
splashscreen I call the timer''s Start() event. HOw do I get the tick event
to fire?
推荐答案
Bob,
有3个计时器,你使用哪一个?
Cor
" Bob"
Bob,
There are 3 timers, which one are you using?
Cor
"Bob"
我有一个在Sub Main的线程上运行的splashscreen,它运行正常。
它在状态栏中显示有关查询的信息。我也有时间使用
启动画面,但是tick事件永远不会被触发。在加载事件中如果
启动画面我调用了计时器的Start()事件。请问我要打开
活动吗?
I have a splashscreen running on a thread from Sub Main and it works OK.
It
displays information in a statusbar about queries. I also have a time on
the
splashscreen, but the tick event never gets fired. In the Load Event if
the
splashscreen I call the timer''s Start() event. HOw do I get the tick
event
to fire?
Bob,
有3个计时器,你使用哪一个?
Cor
" Bob"
Bob,
There are 3 timers, which one are you using?
Cor
"Bob"
我有一个启动画面在Sub Main的一个主题上它运行正常。
它在状态栏中显示有关查询的信息。我也有时间使用
启动画面,但是tick事件永远不会被触发。在加载事件中如果
启动画面我调用了计时器的Start()事件。我是否可以点击
事件来点火?
I have a splashscreen running on a thread from Sub Main and it works OK.
It
displays information in a statusbar about queries. I also have a time on
the
splashscreen, but the tick event never gets fired. In the Load Event if
the
splashscreen I call the timer''s Start() event. HOw do I get the tick
event
to fire?
如Cor所述,有3个计时器可用。由于您正在寻找Tick事件,因此我假设您正在使用System.Windows.Forms.Timer计时器。
此计时器与主要运行在同一个线程上应用程序线程作为一个
的结果,当你正在进行一些处理时,主线程忙于执行
工作,并且不能自由地触发定时器的Tick事件。我会建议使用System.Timers.Timer计时器并观察Elapsed事件
(类似于tick事件)。此计时器运行在与
主应用程序不同的线程上,因此当计时器的间隔完成时,线程将能够触发Elapsed事件
。 br />
希望有所帮助..
Imran。
" Bob" < Bo*@discussions.microsoft.com>在消息中写道
news:36 ********************************** @ microsof t.com ...
As Cor mentioned, there are 3 timers available. Since you are looking for
the Tick event, I assume you are using the System.Windows.Forms.Timer timer.
This timer runs on the same thread as the main application thread. As a
result, while you are doing some processing, the main thread is busy doing
that work and is not free to fire the Tick event of the timer. I would
suggest using the System.Timers.Timer timer and watch for the Elapsed event
(similar to the tick event). This timer runs on a different thread than the
main application and hence the thread will be able to fire the Elapsed event
when the timer''s interval is completed.
hope that helps..
Imran.
"Bob" <Bo*@discussions.microsoft.com> wrote in message
news:36**********************************@microsof t.com...
我在Sub Main的线程上运行了一个启动画面,它运行正常。
它在状态栏中显示有关查询的信息。我也有时间在
的启动画面上,但是tick事件永远不会被触发。在加载事件中,如果
启动画面,我会调用计时器的Start()事件。如果我要点击
事件?
I have a splashscreen running on a thread from Sub Main and it works OK. It displays information in a statusbar about queries. I also have a time on the splashscreen, but the tick event never gets fired. In the Load Event if the splashscreen I call the timer''s Start() event. HOw do I get the tick event to fire?
这篇关于带定时器的螺纹防溅板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文