[英]Point does not exist in namespace System.Drawing
I'm a newbie to C# and trying to run a sample C# program from a tutorial. 我是C#的新手,并试图从教程中运行一个示例C#程序。
When I try to run the below code I get the following error: 当我尝试运行以下代码时,我收到以下错误:
Error 1 The type or namespace name 'Point' does not exist in the namespace 'System.Drawing' (are you missing an assembly reference?) C:\\Users\\Documents\\Visual Studio 2012\\Projects\\HelloWorld\\HelloWorld\\Class1.cs 20 28 HelloWorld
错误1名称空间'System.Drawing'中不存在类型或命名空间名称'Point'(您是否缺少程序集引用?)C:\\ Users \\ Documents \\ Visual Studio 2012 \\ Projects \\ HelloWorld \\ HelloWorld \\ Class1.cs 20 28 HelloWorld
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace HelloWorld
{
class Hello
{
static void Main()
{
Nullable<bool> b = false;
if (b.HasValue) Console.WriteLine("b is {0}", b.Value);
else Console.WriteLine("b is not set");
System.Drawing.Point p = new System.Drawing.Point(20, 30);
Console.WriteLine(b);
Console.WriteLine("Hello World");
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
}
}
In your Solution Explorer right click on References click on Add Reference click on the .NET tab and scroll to System.Drawing
. 在解决方案资源管理器中,右键单击“引用”,单击“添加引用”,单击“.NET”选项卡,然后滚动到“
System.Drawing
。 It should work then. 它应该工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.