加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 命名空间System.Drawing中不存在Point

发布时间:2020-12-15 05:37:29 所属栏目:百科 来源:网络整理
导读:我是C#的新手,并试图从教程中运行一个示例C#程序. 当我尝试运行以下代码时,我收到以下错误: Error 1 The type or namespace name ‘Point’ does not exist in the namespace ‘System.Drawing’ (are you missing an assembly reference?) C:UsersDocume
我是C#的新手,并试图从教程中运行一个示例C#程序.

当我尝试运行以下代码时,我收到以下错误:

Error 1 The type or namespace name ‘Point’ does not exist in the namespace ‘System.Drawing’ (are you missing an assembly reference?) C:UsersDocumentsVisual Studio 2012ProjectsHelloWorldHelloWorldClass1.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();
        }
    }
}

解决方法

在解决方案资源管理器中,右键单击“引用”,单击“添加引用”,单击“.NET”选项卡,然后滚动到“System.Drawing”.它应该工作.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读