Constructors
Initializes a new Size class with an identical width and height
Parameters:
| size (int) | Initial width and height of the size |
Size
#Initializes a new Size class with width and height corresponding to the Point.X and Point.Y of the specified
pointParameters:
| point (Point) | Point to convert to a Size struct |
Fields
Properties
Methods
Abs
#Returns the absolute width and height of the specified
sizeParameters:
| size (Size) | Size to convert |
Returns: A new instance of a Size struct with absolute (positive) width and height
Ceiling
#Converts a floating point
size to an integral size by rounding the width and height to the next integral value.Remarks: This is useful to get a size struct that includes the floating point values completely. As opposed to the Round(SizeF), which will round down to the nearest integral number. For example, a Width or Height of 2.1 or 2.6 would be translated to 3.
Parameters:
| size (SizeF) | Size. |
Contains
#Gets a value indicating that the specified
x and y values are within the Width and Height of this sizeReturns: True if the
x and y values are greater than or equal to 0 and less than the Width and Height of this size, respectively. False otherwiseContains
#Parameters:
| point (Point) | Point to test |
Returns: True if the
point has an X and Y value between 0 and the Width and Height of this size, respectively. False otherwiseEquals
#Compares this size to the specified
objParameters:
| obj (object) | Object to compare with |
Returns: True if the specified
obj is a Size and is equal to this instanceOverrides: ValueType.Equals
Equals
#Compares this size to the
other sizeParameters:
| other (Size) | Other size to compare with |
Returns: True if the
other size is equal to this instanceFitTo
#Fits this size to the specified
constraint, keeping the aspectParameters:
| constraint (Size) | Constraint to fit the new size into |
Returns: The new size with the same aspect ratio with the width/height equal or within the constraint
GetHashCode
#Gets the hash code for this Size
Returns: Hash code value for this size
Overrides: ValueType.GetHashCode
Max
#Returns the maximum width and height of two sizes
Min
#Returns the minimum width and height of two sizes
Round
#Converts a floating point
size to an integral size by rounding the width and heightParameters:
| size (SizeF) | Size to convert |
Returns: A new instance of a Size class with rounded width and height values of the specified
sizeToString
#Converts this Size struct to a string
Returns: String representation of this Size
Overrides: ValueType.ToString
Operators
| Operation | Result | Description | ||
|---|---|---|---|---|
| Size | + | int | Size | Adds a value to the Width and Height of the specified size |
| Size | + | Point | Size | Adds the Point.X and Point.Y value to the Width and Height of a size |
| Size | + | Size | Size | Adds the Width and Height values of two sizes together |
| Size | / | int | Size | Divides the Width and Height of a size by the specified factor |
| Size | / | Size | Size | Divides the Width and Height of two sizes |
| Size | == | Size | bool | Compares two sizes for equality |
| Size | != | Size | bool | Compares two sizes for inequality |
| int | * | Size | Size | Multiplies the Width and Height of a size by the specified factor |
| Size | * | int | Size | Multiplies the Width and Height of a size by the specified factor |
| Size | * | Size | Size | Multiplies the Width and Height of two sizes |
| Size | * | float | SizeF | Multiplies the Width and Height of a size by the specified floating point factor |
| Size | - | int | Size | Subtracts a value from the Width and Height of the specified size |
| Size | - | Point | Size | Subtracts the Point.X and Point.Y value from the Width and Height of a size |
| Size | - | Size | Size | Subtracts the Width and Height value of one size from another |
| - | Size | Size | Negates the Width and Height of the specified size value | |