[TypeConverter(PointFConverterInternal)] public struct PointF : IEquatable<PointF>
A struct representing X and Y co-ordinates as floating point values
Remarks: The point struct is used for drawing and positioning of elements and widgets

Constructors

PointF

#
public PointF(float x, float y)
Initializes a new instance of a Point class with specified x and y values
x (float)Initial X value for the point
y (float)Initial Y value for the point

PointF

#
public PointF(Point point)
Initializes a new instance of a PointF class with values of the Pointpoint
point (Point)Point to initialize the X and Y values of the new instance with

PointF

#
public PointF(SizeF size)
Initializes a new instance of a Point class with X and Y values corresponding to the Size.Width and Size.Height values of the specified size, respecitively
size (SizeF)Size to initialize the X and Y values of the new instance with

Fields

Empty

#
public static readonly PointF Empty
Gets an empty point with an X and Y value of zero

Properties

Angle

#
public float Angle { get; }
Gets the angle of the point as a vector from origin 0,0.

IsZero

#
public bool IsZero { get; }
Gets a value indicating that both the X and Y co-ordinates of this point are zero

Length

#
public float Length { get; }
Gets the length of the point as a vector from origin 0,0

LengthSquared

#
public float LengthSquared { get; }
Gets the squared length of the point as a vector from origin 0,0.

Normal

#
public PointF Normal { get; }
Gets the point as a normal vector (perpendicular) to the current point from the origin

UnitVector

#
public PointF UnitVector { get; }
Gets the current point as a unit vector (a point with a Length of 1.0 from origin 0,0)

Methods

Abs

#
public static PointF Abs(PointF point)
Returns the absolute X and Y components of the specified point
point (PointF)Point with positive or negative X and/or Y values
A new point with absolute (positive) X and Y values of the specified point

AngleTo

#
public float AngleTo(PointF destination)
Gets the angle of the width/height as a vector from the specified destination.
The angle in degrees between this point and destination
destination (PointF)Destination point to determine the angle

Distance

#
public float Distance(PointF point)
Gets the distance between this point and the specified point

Distance

#
public static float Distance(PointF point1, PointF point2)
Gets the distance between two points using pythagoras theorem
point1 (PointF)First point to calculate the distance from
point2 (PointF)Second point to calculate the distance to
The distance between the two points

DotProduct

#
public float DotProduct(PointF point)
Gets the dot product of this instance and the specified point
point (PointF)Point to get the dot product for
The dot product (X * point.X + Y * point.Y) between this point and the specified point

DotProduct

#
public static float DotProduct(PointF point1, PointF point2)
Gets the dot product between two points
point1 (PointF)First point to get the dot product
point2 (PointF)Second point to get the dot product
The dot product (point1.X * point2.X + poin1.Y * point2.Y) between the two points

Equals

#
public override bool Equals(object obj)
Returns a value indicating that the specified obj is equal to this point
obj (object)Object to compare
True if the specified obj is a Point and is equal to this instance, false otherwise
ValueType.Equals

Equals

#
public bool Equals(PointF other)
Returns a value indicating that the specified other point is equal to this point
other (PointF)Other point to compare
True if the other point is equal to this point, otherwise false

GetHashCode

#
public override int GetHashCode()
Gets the hash code of this point

LengthTo

#
public float LengthTo(PointF destination)
Gets the length between this point and the destination point.
destination (PointF)Point to determine the length to.
The length between this instance and the destination .

Max

#
public static PointF Max(PointF point1, PointF point2)
Returns the maximum X and Y components of two points
point1 (PointF)First point
point2 (PointF)Second point
A new point with the maximum X and Y values of the two points

Min

#
public static PointF Min(PointF point1, PointF point2)
Returns the minimum X and Y components of two points
point1 (PointF)First point
point2 (PointF)Second point
A new point with the minimum X and Y values of the two points

Offset

#
public static PointF Offset(PointF point, float x, float y)
Offsets the X and Y co-ordinates of the point by the specified x and y values
point (PointF)Point to offset
x (float)Value to add to the X co-ordinate of this point
y (float)Value to add to the Y co-ordinate of this point
A new point with the offset X and Y values

Offset

#
public static PointF Offset(PointF point, PointF offset)
Offsets the X and Y co-ordinates of the point by the values from the specified offset
point (PointF)Point to offset
offset (PointF)Point with X and Y values to add to this point
A new point offset by the specified value

Offset

#
public void Offset(float x, float y)
Offsets the X and Y co-ordinates of this point by the specified x and y values
x (float)Value to add to the X co-ordinate of this point
y (float)Value to add to the Y co-ordinate of this point

Offset

#
public void Offset(PointF offset)
Offsets the X and Y co-ordinates of this point by the values from the specified offset

Restrict

#
public static Point Restrict(Point point, Rectangle rectangle)
Restricts the X and Y co-ordinates of the specified point within the rectangle
point (Point)Point to restrict
rectangle (Rectangle)Rectangle to restrict the point within
A new point that falls within the rectangle

Restrict

#
public void Restrict(RectangleF rectangle)
Restricts the X and Y co-ordinates within the specified rectangle
Remarks: This will update the X and Y co-ordinates to be within the specified rectangle's bounds. The updated co-ordinates will be the closest to the original value as possible. E.g. if the X co-ordinate is greater than the Rectangle.Right of the rectangle, it will be set to be Rectangle.Right minus one, to be within the rectangle's bounds.
rectangle (RectangleF)Rectangle to restrict the X and Y co-ordinates in

Rotate

#
public static PointF Rotate(PointF point, float angle)
Treats the point as a vector and rotates it around the origin (0,0) by the specified angle.
point (PointF)Point to rotate
angle (float)Angle in degrees to rotate the point around the origin (0,0)
A new point with the rotated X and Y coordinates

Rotate

#
public void Rotate(float angle)
Treats the point as a vector and rotates it around the origin (0,0) by the specified angle.
angle (float)Angle in degrees to rotate this point around the origin (0,0)

ToString

#
public override string ToString()
Converts this point to a string

UnitVectorAtAngle

#
public static PointF UnitVectorAtAngle(float angle)
Creates a unit vector PointF (a point with a Length of 1.0 from origin 0,0) with the specified angle, in degrees
angle (float)Angle in degrees of the unit vector
A new instance of a PointF with the x,y co-ordinates set at a distance of 1.0 from the origin

Operators

OperationResultDescription
PointF+floatPointFOperator to add a value to both the X and Y co-ordinates of a point
PointF+SizeFPointFOperator to add a size to a point
PointF+PointFPointFOperator to return the addition of two points as a PointF
PointF/floatPointFDivides the X and Y co-ordinates of the specified point with a given value
PointF/SizeFPointFDivides the specified point with a size
PointF==PointFboolDetermines equality between two points
PointF!=PointFboolDetermines the inequality between two points
float*PointFPointFMultiplies the X and Y co-ordinates of the specified point with a given factor
PointF*floatPointFMultiplies the X and Y co-ordinates of the specified point with a given factor
PointF*SizeFPointFMultiplies the specified point with a size
PointF*PointFPointFMultiplies the X and Y co-ordinates of the two specified point values
PointF-floatPointFOperator to subtract a value from both the X and Y co-ordinates of a point
PointF-SizeFPointFOperator to subtract a size from a point
PointF-PointFPointFOperator to return the difference between two points as a PointF
-PointFPointFReturns a new PointF with negative x and y values of the specified point

Convertors

OperationResultDescription
explicitSizeFPointFExplicit conversion from a size to a PointF with a X and Y of the Width and Height values of the size, respectively
implicitPointPointFImplicit conversion from a Point to a PointF