一个新手关于对 System.Drawing 和 System.Windows.Forms的疑问

menghan9920 2006-11-01 10:13:29
using System;
using System.Drawing;
using System.Windows.Forms;

namespace _01_04
{
public class Form_01_04 :System.Windows.Forms.Form
{
public Form_01_04()
{
Height = 200;
Width = 500;
Text = "My first Windows Form!";
}
}

public class Class_01_04
{
public static void Main(String[] args)
{
Form form=new Form_05_04();
Application.Run(form);
}
}
}


错误 1 命名空间“System”中不存在类型或命名空间名称“Drawing”(是缺少程序集引用吗?) D:\Program Files\MyC\ConsoleApplication4\ConsoleApplication4\Program.cs 2 14 ConsoleApplication4
错误 2 命名空间“System”中不存在类型或命名空间名称“Windows”(是缺少程序集引用吗?) D:\Program Files\MyC\ConsoleApplication4\ConsoleApplication4\Program.cs 3 14 ConsoleApplication4
错误 3 命名空间“System”中不存在类型或命名空间名称“Windows”(是缺少程序集引用吗?) D:\Program Files\MyC\ConsoleApplication4\ConsoleApplication4\Program.cs 7 37 ConsoleApplication4

...全文
141 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Macosx 2006-11-01
  • 打赏
  • 举报
回复
右击工程选择添加Dll引用
wxdl1981 2006-11-01
  • 打赏
  • 举报
回复
Winform的程序在新建的时候应该选择WindowsApplication,而不是ConsoleApplication, ConsoleApplication是命令行程序,没有窗体和图形的
wxdl1981 2006-11-01
  • 打赏
  • 举报
回复
添加Dll引用
blacksunday 2006-11-01
  • 打赏
  • 举报
回复
using System;
using System.Drawing;
using System.Windows.Forms;

namespace _01_04
{
public class Form_01_04 :System.Windows.Forms.Form
{
public Form_01_04()
{
Height = 200;
Width = 500;
Text = "My first Windows Form!";
}
}

public class Class_01_04
{
public static void Main(String[] args)
{
Form_01_04 form=new Form_01_04();
Application.Run(new Form_01_04());
}
}
}
liujiwe79 2006-11-01
  • 打赏
  • 举报
回复
在引用中添加对这两个dll的引用
menghan9920 2006-11-01
  • 打赏
  • 举报
回复
是不是要把using 改掉?
怎么改?
dreamlins 2006-11-01
  • 打赏
  • 举报
回复
using System.Drawing;
using System.Windows.Forms;
用在winform里面的啊
menghan9920 2006-11-01
  • 打赏
  • 举报
回复
麻烦大家帮帮忙阿 我的是VS2005
灰太狼 2006-11-01
  • 打赏
  • 举报
回复
wxdl1981(沉默之狼) 說的對

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧