Name

Point

Synopsis

This value type represents a point in a 2D coordinate system. It uses integers to define the X and Y coordinates of that point.

A point has no size in and of itself, but on a pixel-based device context, the pixels are of finite size. The point {0,0} is therefore located at the center of the pixel (0,0).

You can compare a point to another point using the standard equality operator, and add or subtract Size quantities from it. There is a conversion operator from Point to Size if required.

The PointF class is equivalent to Point but uses real values instead of integers. You can convert from PointF to Point using the Round(), Truncate( ), and Ceiling() members to control the loss of precision. To go the other way, there is a conversion operator from Point to PointF.

It also provides an Empty property to represent a null point.


public struct Point {

// Public Constructors

   public Point(int dw);

   public Point(int x, int y);

   public Point(Size sz);

// Public Static Fields

   public static readonly Point Empty;  // = {X=0,Y=0}

                  // Public Instance Properties

   public bool IsEmpty{get; }

   public int X{set; get; }

   public int Y{set; get; }

// Public Static Methods

   public static Point Ceiling(PointF value);

   public static Point Round(PointF value);

   public static Point Truncate(PointF value);

   public static Point operator -(Point pt, Size sz);

   public static Point operator +(Point pt, Size sz);

   public static bool operator !=(Point left, Point right);

   public static bool operator ==(Point left ...

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.