4

UIスレッドのみが画面に表示できますか、それとも他のスレッドもこれを実行できますか?

4

3 に答える 3

7

いいえ、UIスレッドから直接UIにアクセスすることしかできませんが、Control.Invokeやcontrol.BegineInvoke / EndInvokeを使用するなど、他のスレッドからの結果をマーシャリングすることはできます。

これをチェックしてください

于 2011-05-19T18:20:04.143 に答える
1

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.

于 2011-05-19T18:20:52.503 に答える
0

また、WinFormsとWPFのどちらを使用しているかによって異なりますが、WinformsではControl.Invokeを使用し、WPFではDispatcherクラスを使用します。WPFにはより洗練されたスレッドUIディスパッチャーがあります

于 2011-05-20T09:38:50.583 に答える