c# - how to run a winform from console application? -
How can I create, execute and control a winform from within a console application?
The easiest option is to start a Windows project, then change the output-type to a console application. Alternatively, just add a reference to System.Windows.Forms.dll, and start coding:
Using the system. Windows.Forms; [STAThread] Fixed Zero Main () {Application.EnableVisualStyles (); Application.Run (new form ()); // or whatever) Important bit [your , required for full COM support is . main () method on [STAThread]
Comments
Post a Comment