我不知道你是什麼意思,但你總是可以嘗試一個特定的形式中運行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線程? –