我正在制作一个C#窗体窗体应用程序。我想在我的表单应用程序中使用Console.write()。我读了很多东西。但没有奏效。你能给我一个干净的代码来实现这一目标吗? 在此先感谢。如何Console.write()在C#窗体窗体应用程序
P.S.
[DllImport("kernel32.dll")]
static extern bool AttachConsole(int dwProcessId);
private const int ATTACH_PARENT_PROCESS = -1;
public Form1()
{
InitializeComponent();
AttachConsole(ATTACH_PARENT_PROCESS);
Console.WriteLine("This is from the main program");
}
这不适合我。
看这里(问题和答案):http://stackoverflow.com/questions/7743387/behavior-in-winform-console-hybrid-application – elgonzo
也看看这里:http://stackoverflow.com/questions/7613880 /从控制台和winforms-applications-when-running-from-cmd – elgonzo
你需要什么? Winform应用程序也有控制台窗口?你想在控制台中写入? –