开发者

How to get a form to refresh when there's intense code working in the background?

I have a Windows form that I'd like to be able to refresh with a status of the work that's going on in the background in different threads.

Problem is, even if I change the label on the form, it doesn't immediately refresh; it seems that the work happening on the other worker threads is preventing the screen from updating.

How do I force the form to refresh the ne开发者_JAVA技巧w value of the status label immediately?


Shortest path:

label1.Text = "....";
label1.Update();


I asked a similar question a few days ago.

The best option, that I'm using now, is a separate thread running a status form.

This is the suggested solution, that I received, which works by displaying a form, which then updates on a 'tick', and ensures that regardless of whether the UI on your app is updated or not, the status form is updated.

Cheers

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜