引入后代码中直接Console.WriteLine()打印
在kernel32.dll导入控制台的两个方法:AllocConsole()+FreeConsole()
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace LegendTool
{
static class Program
{
[DllImport("kernel32.dll")]
static extern bool FreeConsole();
[DllImport("kernel32.dll")]
public static extern bool AllocConsole();
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
// LoadResoureDll.RegistDLL();
AllocConsole();//调用系统API,调用控制台窗口
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
FreeConsole();//释放控制台
}
}
}
..