2010-10-30 28 views
-1

我有一個簡單的程序,並且我添加了一個windows窗體,我必須從窗體頂部啓動窗體嗎?如何在c中啓動一個windows窗體#

+0

什麼是項目類型? Windows窗體,類庫,控制檯應用程序 – 2010-10-30 12:18:04

回答

0

爲了顯示形式的對話,等待它被關閉:

var form2 = new Form2(); 
var result = form2.ShowDialog(); 

要顯示的形式作爲第二頂層形式:

var form2 = new Form2(); 
form2.Show(); 
1

Application.Run(新Form1中());

0

我想你想用你的表單啓動程序。

Application.Run(new MyForm());

0

在你可以寫的主要方法,

Application.Run(new YourFormClassName()); 
+0

我需要命名空間或其他東西嗎?應用程序將不會被intellisense – murtek 2010-10-30 11:41:28

+1

System.Windows.Forms – thelost 2010-10-30 11:46:42

+1

不要忘記添加[STAThread]屬性到Main(),非常重要。 – 2010-10-30 13:05:16

相關問題