开发者

Sleep thread before hiding control in WinForms?

In a WinForms environment, I want to wait a specified amount of time before hiding a user control, but I don't want to freeze the entire UI. I can't kick off to another thre开发者_如何转开发ad because I have to service the UI components on the thread they were created on. What is the cleanest way to do this?


I would use a System.Windows.Forms.Timer. The Tick event will execute on the UI (message loop) thread.


Starting a second thread for this works fine as long as you use Invoke to communicate with the form from your thread.

However, the best way would be to use a Timer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜