[TypeConverter(SizeFConverterInternal)] public struct SizeF : IEquatable<SizeF>
Represents a floating point size with width and height components

Constructors

SizeF

#Since v2.14
public SizeF(float size)
Initializes a new SizeF class with an identical width and height

SizeF

#
public SizeF(float width, float height)
Initializes a new SizeF class with the specified width and height
width (float)Initial width of the size
height (float)Initial height of the size

SizeF

#
public SizeF(PointF point)
Initializes a new SizeF class with width and height corresponding to the PointF.X and PointF.Y of the specified point

Fields

Empty

#
public static readonly SizeF Empty
Gets an empty size with a zero width and height

MaxValue

#
public static readonly SizeF MaxValue
SizeF with width and height with a maximum float value

MinValue

#
public static readonly SizeF MinValue
SizeF with width and height with a minimum float value

NegativeInfinity

#
public static readonly SizeF NegativeInfinity
A SizeF with the width and height set to float.NegativeInfinity

PositiveInfinity

#
public static readonly SizeF PositiveInfinity
A SizeF with the width and height set to float.PositiveInfinity

Properties

Methods

Abs

#
public static SizeF Abs(SizeF size)
Returns the absolute width and height of the specified size
size (SizeF)Size to convert
A new instance of a Size struct with absolute (positive) width and height

Contains

#
public bool Contains(float x, float y)
Gets a value indicating that the specified x and y values are within the Width and Height of this size
x (float)X value to test
y (float)Y value to test
True if the x and y values are between 0 and the Width and Height of this size, respectively. False otherwise

Contains

#
public bool Contains(PointF point)
Gets a value indicating that the specified point is within the Width and Height of this size
point (PointF)Point to test
True if the point has an X and Y value between 0 and the Width and Height of this size, respectively. False otherwise

Equals

#
public override bool Equals(object obj)
Compares this size to the specified obj
obj (object)Object to compare with
True if the specified obj is a Size and is equal to this instance
ValueType.Equals

Equals

#
public bool Equals(SizeF other)
Compares this size to the other size
other (SizeF)Other size to compare with
True if the other size is equal to this instance

FitTo

#
public SizeF FitTo(SizeF constraint)
Fits this size to the specified constraint, keeping the aspect
constraint (SizeF)Constraint to fit the new size into
The new size with the same aspect ratio with the width/height equal or within the constraint

GetHashCode

#
public override int GetHashCode()
Gets the hash code for this Size

Max

#
public static SizeF Max(SizeF size1, SizeF size2)
Returns the maximum width and height of two sizes
size1 (SizeF)First size to get the maximum values
size2 (SizeF)Second size to get the maximum values
A new instance of a Size struct with the maximum width and height of either sizes

Min

#
public static SizeF Min(SizeF size1, SizeF size2)
Returns the minimum width and height of two sizes
size1 (SizeF)First size to get the minimum values
size2 (SizeF)Second size to get the minimum values
A new instance of a Size struct with the minimum width and height of either sizes

ToString

#
public override string ToString()
Converts this Size struct to a string

Operators

OperationResultDescription
SizeF+floatSizeFAdds a value to the Width and Height of the specified size
SizeF+SizeFSizeFAdds the Width and Height values of two sizes together
SizeF/floatSizeFDivides the Width and Height of a size by the specified factor
SizeF/SizeFSizeFDivides the Width and Height of two sizes
SizeF==SizeFboolCompares two sizes for equality
SizeF!=SizeFboolCompares two sizes for inequality
float*SizeFSizeFMultiplies the Width and Height of a size by the specified factor
SizeF*floatSizeFMultiplies the Width and Height of a size by the specified factor
SizeF*SizeFSizeFMultiplies the Width and Height of two sizes
SizeF-floatSizeFSubtracts a value from the Width and Height of the specified size
SizeF-SizeFSizeFSubtracts the Width and Height value of one size from another
-SizeFSizeFNegates the Width and Height of the specified size value

Convertors

OperationResultDescription
explicitPointFSizeFExplicit conversion from a point to a Size with a Width and Height of the X and Y values of the point, respectively
implicitSizeSizeFImplicitly converts the specified integral size to a floating point SizeF