Point Structure
Collapse the table of content
Expand the table of content

Point Structure


Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional plane.

Namespace:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

public value struct Point


Initializes a new instance of the Point class using coordinates specified by an integer value.

System_CAPS_pubmethodPoint(Int32, Int32)

Initializes a new instance of the Point class with the specified coordinates.


Initializes a new instance of the Point class from a Size.


Gets a value indicating whether this Point is empty.


Gets or sets the x-coordinate of this Point.


Gets or sets the y-coordinate of this Point.

System_CAPS_pubmethodSystem_CAPS_staticAdd(Point, Size)

Adds the specified Size to the specified Point.


Converts the specified PointF to a Point by rounding the values of the PointF to the next higher integer values.


Specifies whether this Point contains the same coordinates as the specified Object.(Overrides ValueType::Equals(Object^).)


Returns a hash code for this Point.(Overrides ValueType::GetHashCode().)


Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodOffset(Int32, Int32)

Translates this Point by the specified amount.


Translates this Point by the specified Point.


Converts the specified PointF to a Point object by rounding the Point values to the nearest integer.

System_CAPS_pubmethodSystem_CAPS_staticSubtract(Point, Size)

Returns the result of subtracting specified Size from the specified Point.


Converts this Point to a human-readable string.(Overrides ValueType::ToString().)


Converts the specified PointF to a Point by truncating the values of the Point.


Represents a Point that has X and Y values set to zero.

System_CAPS_puboperatorSystem_CAPS_staticAddition(Point, Size)

Translates a Point by a given Size.

System_CAPS_puboperatorSystem_CAPS_staticEquality(Point, Point)

Compares two Point objects. The result specifies whether the values of the X and Y properties of the two Point objects are equal.

System_CAPS_puboperatorSystem_CAPS_staticExplicit(Point to Size)

Converts the specified Point structure to a Size structure.

System_CAPS_puboperatorSystem_CAPS_staticImplicit(Point to PointF)

Converts the specified Point structure to a PointF structure.

System_CAPS_puboperatorSystem_CAPS_staticInequality(Point, Point)

Compares two Point objects. The result specifies whether the values of the X or Y properties of the two Point objects are unequal.

System_CAPS_puboperatorSystem_CAPS_staticSubtraction(Point, Size)

Translates a Point by the negative of a given Size.

To convert a Point to a PointF, use Implicit(Point to PointF).

The following code example creates points and sizes using several of the overloaded operators defined for these types. It also demonstrates how to use the SystemPens class.

This example is designed to be used with Windows Forms. Create a form that contains a Button named subtractButton. Paste the code into the form and call the CreatePointsAndSizes method from the form's Paint event-handling method, passing e as PaintEventArgs.

void CreatePointsAndSizes( PaintEventArgs^ e )
   // Create the starting point.
   Point startPoint = Point(subtractButton->Size);

   // Use the addition operator to get the end point.
   Point endPoint = startPoint + System::Drawing::Size( 140, 150 );

   // Draw a line between the points.
   e->Graphics->DrawLine( SystemPens::Highlight, startPoint, endPoint );

   // Convert the starting point to a size and compare it to the
   // subtractButton size.  
   System::Drawing::Size buttonSize = (System::Drawing::Size)startPoint;
   if ( buttonSize == subtractButton->Size )
      e->Graphics->DrawString( "The sizes are equal.", gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), Brushes::Indigo, 10.0F, 65.0F );

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
© 2015 Microsoft