2013-04-08 5 views
5

저는 C#의 초보자이며 튜토리얼에서 샘플 C# 프로그램을 실행하려고합니다.포인트가 네임 스페이스 System.Drawing에 존재하지 않습니다.

나는 다음과 같은 오류 얻을 수 아래의 코드를 실행하려고하면 : 바로 참조를 클릭하십시오 솔루션 탐색기에서

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

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(); 
     } 
    } 
} 
+7

프로젝트에'System.Drawing.dll'에 대한 참조가 있습니까? 이는 기본적으로 오류 메시지에 대한 내용입니다. –

+0

System.Drawing.dll에 대한 참조를 추가하려면 어떻게해야합니까? dll을 다운로드해야합니까, 아니면 내 컴퓨터에서 DLL을 찾고 컴파일러를 가리 키도록합니까? – user1050619

+5

VS에서 솔루션 탐색기 -> 마우스 오른쪽 단추로 참조 -> 참조 추가 -> NET-> whatever –

답변

2

를 .NET 탭에서 참조 추가 클릭 클릭하고 System.Drawing로 이동 . 그때 작동합니다.

관련 문제