Struct SizeF
Represents the size of a rectangular region with an ordered pair of floats.
Implements
Inherited Members
Namespace: DRIT.Drawing.Geometry
Assembly: DRIT.Drawing.dll
Syntax
public struct SizeF : IEquatable<SizeF>
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
Constructors
SizeF(PointF)
Declaration
public SizeF(PointF pt)
Parameters
| Type | Name | Description |
|---|---|---|
| PointF | pt | The point to convert to a size. |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
SizeF(SizeF)
Initializes a new SizeF as a copy of another size.
Declaration
public SizeF(SizeF sz)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | sz | The size to copy. |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
SizeF(float, float)
Initializes a new SizeF with the specified width and height.
Declaration
public SizeF(float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| float | width | The width. |
| float | height | The height. |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
Fields
Empty
Gets an empty SizeF (0, 0).
Declaration
public static readonly SizeF Empty
Field Value
| Type | Description |
|---|---|
| SizeF |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
Height
Gets or sets the height.
Declaration
public float Height
Field Value
| Type | Description |
|---|---|
| float |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
Width
Gets or sets the width.
Declaration
public float Width
Field Value
| Type | Description |
|---|---|
| float |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
Properties
IsEmpty
Gets a value indicating whether this size is empty (0, 0).
Declaration
public bool IsEmpty { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
Methods
Add(SizeF, SizeF)
Adds two sizes.
Declaration
public static SizeF Add(SizeF sz1, SizeF sz2)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | sz1 | The first size. |
| SizeF | sz2 | The second size. |
Returns
| Type | Description |
|---|---|
| SizeF | The resulting size. |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
Equals(SizeF)
Indicates whether this size is equal to another size.
Declaration
public bool Equals(SizeF other)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | other | The size to compare. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
Equals(object?)
Indicates whether this size is equal to another object.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare. |
Returns
| Type | Description |
|---|---|
| bool |
|
Overrides
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
GetHashCode()
Returns a hash code for this size.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | The hash code. |
Overrides
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
Subtract(SizeF, SizeF)
Subtracts the second size from the first.
Declaration
public static SizeF Subtract(SizeF sz1, SizeF sz2)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | sz1 | The size to subtract from. |
| SizeF | sz2 | The size to subtract. |
Returns
| Type | Description |
|---|---|
| SizeF | The resulting size. |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
ToPointF()
Declaration
public PointF ToPointF()
Returns
| Type | Description |
|---|---|
| PointF | A new PointF with the same dimensions. |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
ToSize()
Truncates each dimension to the nearest integer toward zero.
Declaration
public Size ToSize()
Returns
| Type | Description |
|---|---|
| Size | A new Size with truncated dimensions. |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
ToString()
Returns a string representation of this size.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | A string in the format "{Width=value, Height=value}". |
Overrides
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
Operators
operator +(SizeF, SizeF)
Adds two sizes.
Declaration
public static SizeF operator +(SizeF sz1, SizeF sz2)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | sz1 | |
| SizeF | sz2 |
Returns
| Type | Description |
|---|---|
| SizeF |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
operator ==(SizeF, SizeF)
Compares two sizes for equality.
Declaration
public static bool operator ==(SizeF left, SizeF right)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | left | |
| SizeF | right |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
operator !=(SizeF, SizeF)
Compares two sizes for inequality.
Declaration
public static bool operator !=(SizeF left, SizeF right)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | left | |
| SizeF | right |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.
operator -(SizeF, SizeF)
Subtracts two sizes.
Declaration
public static SizeF operator -(SizeF sz1, SizeF sz2)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeF | sz1 | |
| SizeF | sz2 |
Returns
| Type | Description |
|---|---|
| SizeF |
Remarks
A SizeF represents the width and height of a rectangle. Width and Height are public fields for performance reasons, matching the System.Drawing API.