csdn功能真强大,做美化代码用的tmp

来源:互联网 发布:smtp 端口号 编辑:程序博客网 时间:2024/05/30 23:24

复制首部

 

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Runtime.InteropServices;
  9. namespace 在WinForm中启动控制台
  10. {
  11.     public partial class Form1 : Form
  12.     {
  13.         public Form1()
  14.         {
  15.             InitializeComponent();
  16.         }
  17.         [DllImport("Kernel32.dll")]
  18.         static extern bool AllocConsole();
  19.         [DllImport("Kernel32.dll")]
  20.         static extern bool FreeConsole();
  21.         private void button1_Click(object sender, EventArgs e)
  22.         {
  23.             AllocConsole();
  24.             Console.WriteLine("hello");
  25.             //FreeConsole();释放掉
  26.         }
  27.     }
  28. }

复制尾部

原创粉丝点击