how to run a winform from console application?
问题 How do I create, execute and control a winform from within a console application? 回答1: The easiest option is to start a windows forms project, then change the output-type to Console Application. Alternatively, just add a reference to System.Windows.Forms.dll, and start coding: using System.Windows.Forms; [STAThread] static void Main() { Application.EnableVisualStyles(); Application.Run(new Form()); // or whatever } The important bit is the [STAThread] on your Main() method, required for full