最简单的选项是启动Windows窗体项目,然后将输出类型更改为Console
Application。或者,只需添加对System.Windows.Forms.dll的引用,然后开始编码:
using System.Windows.Forms;[STAThread]static void Main() { Application.EnableVisualStyles(); Application.Run(new Form()); // or whatever}重要的一点是
[STAThread]您的
Main()方法所必需的,这是完整COM支持所必需的。



