[Visual Studio 2008中]什麼使得應用程序控制臺或Windows窗體應用程序?
我創建控制檯應用程序的新項目,並修改它看起來像這樣:
class Program
{
static void Main (string[] args) {
Thread.Sleep (2000);
}
}
然後,我創造了另一個項目的Windows窗體應用程序,並修改了它:
static class Program
{
//[STAThread] commented this line
static void Main (string[] args) { //Added args
//Commented following lines
//Application.EnableVisualStyles();
//Application.SetCompatibleTextRenderingDefault (false);
//Application.Run (new Form1()); commented this line
Thread.Sleep (2000);
}
}
現在我沒有在第一個應用程序中編寫控制檯函數(Console.Write等),也沒有在第二個應用程序中編寫過與表單相關的操作。看起來和我完全一樣。
第一個應用程序顯示BLACK窗口,第二個應用程序不顯示任何內容。是什麼讓它像這樣工作?
您可以使用適當的編譯器開關將任何項目類型編譯爲程序集。 – Perpetualcoder 2009-05-29 07:30:17