Name

PointF

Synopsis

This is a value type that represents a point in a 2D coordinate system. It uses reals to define the X and Y coordinates of that point (c.f. Point).

As with Point, a PointF {0.0, 0.0} is located at the center of the pixel (0,0). However, if you specify a point at {0.5, 0.5} and draw a single pixel at that location, the rendering engine must resolve that into something it can draw on the device’s pixel array, as it will impact at least 4 adjacent pixels in that grid. The method it uses to resolve that issue is determined by various properties of the Graphics object, including PixelOffsetMode, CompositingMode, and SmoothingMode.

There are comparison operators between PointF objects, and addition and subtraction operators for Size objects (but not SizeF objects, curiously).

Conversions between PointF and Point are handled through methods and operators on the Point class.


public struct PointF {

// Public Constructors

   public PointF(float x, float y);

// Public Static Fields

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

                  // Public Instance Properties

   public bool IsEmpty{get; }

   public float X{set; get; }

   public float Y{set; get; }

// Public Static Methods

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

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

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

   public static bool operator ==(PointF left, PointF right);

// Public Instance Methods

   public override bool Equals(object obj);  // overrides ValueType ...

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.