700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > C# winform程序调用Console控制台办法

C# winform程序调用Console控制台办法

时间:2024-06-19 20:16:37

相关推荐

C# winform程序调用Console控制台办法

using System;using System.Collections.Generic;using System.Linq;using System.Threading.Tasks;using System.Windows.Forms;using System.Runtime.InteropServices; //1加命名空间namespace WindowsFormsApp1{static class Program{// 引用win32api[DllImport("kernel32.dll")] static extern bool FreeConsole();[DllImport("kernel32.dll")]public static extern bool AllocConsole();/// <summary>/// 应用程序的主入口点。/// </summary>/// [STAThread]static void Main(){AllocConsole();//调用系统API,调用控制台窗口Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Form1.Fun();Console.ReadLine();Application.Run(new Form1());FreeConsole();//释放控制台}}}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。