C# ShowDialog() doesn't block main form when triggered from thread

后端 未结 1 1209
栀梦
栀梦 2021-01-23 17:58

I have a Windows Forms application with a main form and several background threads. In order to show \"nice\" messages I implemented a form to be shown as a modal dialog using <

相关标签:
1条回答
  • 2021-01-23 18:13

    How can I make sure that every call to ShowDialog() will block the main form?

    Execute the calls to ShowDialog() on the main thread. If you need to invoke them from a different thread, use Invoke() to run them on the main thread.

    0 讨论(0)
提交回复
热议问题