Struct SizeF
Stores an ordered pair of floating-point numbers, typically the width and height of a rectangle.
public struct SizeF
- Inherited Members
Constructors
SizeF(PointF)
public SizeF(PointF point)
Parameters
SizeF(SizeF)
public SizeF(SizeF size)
Parameters
SizeF(float, float)
Initializes a new instance of the SizeF structure from the specified dimensions.
public SizeF(float width, float height)
Parameters
width
floatThe width component of the new SizeF.
height
floatThe height component of the new SizeF.
Properties
Empty
public static SizeF Empty { get; }
Property Value
Height
Gets or sets the vertical component of this SizeF.
public float Height { get; set; }
Property Value
IsEmpty
Gets a value indicating whether this SizeF has zero width and height.
public bool IsEmpty { get; }
Property Value
- bool
This property returns true when this SizeF has both a width and height of zero; otherwise, false.
Width
Gets or sets the horizontal component of this SizeF.
public float Width { get; set; }
Property Value
Methods
Add(SizeF, SizeF)
Adds the width and height of one SizeF structure to the width and height of another SizeF structure.
public static SizeF Add(SizeF size1, SizeF size2)
Parameters
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
Returns
- bool
This method returns true if
obj
is a SizeF and has the same width and height as this SizeF; otherwise, false.
GetHashCode()
Returns a hash code for this Size structure.
public override int GetHashCode()
Returns
Subtract(SizeF, SizeF)
Subtracts the width and height of one SizeF structure from the width and height of another SizeF structure.
public static SizeF Subtract(SizeF size1, SizeF size2)
Parameters
size1
SizeFThe SizeF structure on the left side of the subtraction operator.
size2
SizeFThe SizeF structure on the right side of the subtraction operator.
Returns
ToPointF()
public PointF ToPointF()
Returns
ToSize()
public Size ToSize()
Returns
ToString()
Creates a human-readable string that represents this SizeF.
public override string ToString()
Returns
Operators
operator +(SizeF, SizeF)
Adds the width and height of one SizeF structure to the width and height of another SizeF structure.
public static SizeF operator +(SizeF size1, SizeF size2)
Parameters
Returns
operator ==(SizeF, SizeF)
Tests whether two SizeF structures are equal.
public static bool operator ==(SizeF size1, SizeF size2)
Parameters
size1
SizeFThe SizeF structure on the left side of the equality operator.
size2
SizeFThe SizeF structure on the right of the equality operator.
Returns
- bool
This operator returns true if
size1
andsize2
have equal width and height; otherwise, false.
explicit operator PointF(SizeF)
public static explicit operator PointF(SizeF size)
Parameters
Returns
operator !=(SizeF, SizeF)
Tests whether two SizeF structures are different.
public static bool operator !=(SizeF size1, SizeF size2)
Parameters
size1
SizeFThe SizeF structure on the left of the inequality operator.
size2
SizeFThe SizeF structure on the right of the inequality operator.
Returns
- bool
This operator returns true if
size1
andsize2
differ either in width or height; false ifsize1
andsize2
are equal.
operator -(SizeF, SizeF)
Subtracts the width and height of one SizeF structure from the width and height of another SizeF structure.
public static SizeF operator -(SizeF size1, SizeF size2)
Parameters
size1
SizeFThe SizeF on the left side of the subtraction operator.
size2
SizeFThe SizeF on the right side of the subtraction operator.