Amazing User
Amazing User

Reputation: 3563

Can't find "Point" in System.Drawing

As I know, Point are exist in namespace System.Drawing, but Visual Studio can't find it.

using System.Drawing;
class Flower
{
    public Point Location { get; private set; }
}

Error: Can't find name of type or namespace "Point"

Edit 1: .Net 4.5.1

Upvotes: 2

Views: 2845

Answers (2)

John Koerner
John Koerner

Reputation: 38077

As others have indicated, you are missing a reference to System.Drawing in your project. The reason this works in some project types and not others is that some project types, specifically Windows Forms projects, will automatically add the reference to System.Drawing for you. While other project types like Console App, Class Library, or WPF Application do not automatically have that reference, so you have to manually add it.

Upvotes: 3

jdphenix
jdphenix

Reputation: 15445

Right click in Solution Explorer on your Project's References entry and click on Add Reference...

Context menu

Make sure you're looking under Assemblies --> Framework, then find and check the checkbox for System.Drawing, then click OK.

References

From here, you can useSystem.Drawing.Point in your code.

Upvotes: 7

Related Questions