我不知道你是什么意思,但你总是可以尝试一个特定的形式中运行Show()
,如果你想显示的形式,而不会阻塞主UI
例
Form2 _Form2 = new Form2();
_Form2.Show();
或者,如果您希望异步运行新窗体作为应用程序的主窗体,则可以尝试创建一个新的Thread
并运行其中的窗体
例
public void RunThread()
{
Thread thread = new Thread(new ThreadStart(RunForm)); //Create a new thread to execute RunForm()
thread.Name = "NewForm"; //Name the new thread (Not required)
thread.Start(); //Start executing RunForm() in the new thread
}
public void RunForm()
{
try
{
Application.Run(new Form2()); //Run Form2() as the main form of the application
}
catch (Exception ex)
{
//DoSomething
//MessageBox.Show(ex.Message);
}
}
谢谢,
我希望对您有所帮助:)
可以显示()的形式和最顶层设置为true。 – Blorgbeard
谢谢,但它会顶部所有的窗口不仅主要的UI线程? –