Can non-UI threads display to the screen?
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
精彩评论