C#的WinForms:多个顶级窗口和的ShowDialog() [英] C# Winforms: Multiple top level windows and ShowDialog()
本文介绍了C#的WinForms:多个顶级窗口和的ShowDialog()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Winforms应用程序使用显示多个顶级窗口:
I have a Winforms application that uses show multiple top-level windows:
Form1 form1 = new Form1();
form1.Show();
Form2 form2 = new Form2();
form2.Show();
Application.Run();
在Form1中的一个事件处理程序中,我希望能够显示一个模态对话框:
Inside one of the event-handlers in Form1, I would like to be able to show a modal dialog:
Dialog dialog = new Dialog();
dialog.ShowDialog(form1);
,而不挂起其他顶级窗口。
without suspending the other top-level window.
这是否可能?
推荐答案
每个顶层窗口都在自己的STA线程上实现,我相信。
You'd need to run each top-level window on its own STA thread to achieve that, I believe.
这篇关于C#的WinForms:多个顶级窗口和的ShowDialog()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文