在c#中,为什么控制台应用程序里不能使用system.windows.form这个命名空间呢

来源:百度知道 编辑:UC知道 时间:2024/05/10 09:21:28
在c#中,为什么控制台应用程序里不能使用system.windows.form这个命名空间呢

可以的
在解决方案上右键,添加引用,找到system.windows.form,添加进去就可以使用了
比如,下面这个控制台程序就能弹出一个对话框

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
MessageBox.Show("hello,world");
}
}
}

控制台应用程序用于调试,没有包含图型库。所以没有.