📅  最后修改于: 2022-03-11 14:49:09.011000             🧑  作者: Mango
//you normally cant add a console in a winform project but heres how to do it programmatically so you can
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
//allocate console, call AllocateConsole to start the console
public static extern bool AllocConsole();
//use this function when your application starts + when you want to update the console
public static void Update(string title, string message)
{
Console.Title = title;
Console.WriteLine(message);
}