开发者

Can non-UI threads display to the screen?

开发者 https://www.devze.com 2023-03-07 06:33 出处:网络
Is only the UI-thread able to display to the screen, or can oth开发者_如何学JAVAer threads do this as well?No you can only access to UI directly from the UI thread but you can marshal the results from

Is only the UI-thread able to display to the screen, or can oth开发者_如何学JAVAer threads do this as well?


No you can only access to UI directly from the UI thread but you can marshal the results from other threads, such as using the Control.Invoke or control.BegineInvoke/EndInvoke

Check this out


You can use the BeginInvoke() member of all GUI controls to change the values of their properties from background threads.
If you are using a backgroundworker you could use the ReportProgress event, which is even easier.


also Depends if you are using WinForms or WPF, in Winforms you use Control.Invoke and in WPF you use Dispatcher class. WPF has more sophisticated thread UI dispatcher

0

精彩评论

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

关注公众号