using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;///重要
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
//输出信息之前,先AllocConsole() ,用完后 FreeConsole()
[DllImport("kernel32.dll")]
public static extern Boolean AllocConsole();
[DllImport("kernel32.dll")]
public static extern Boolean FreeConsole();
public Form1()
{
InitializeComponent();
AllocConsole();///重要
Console.Write("输出到控制台");
}
}
}
c# winform实现输出数据到Console控制台窗台
最新推荐文章于 2024-07-10 10:02:20 发布