Struct Thickness
Thickness is a value type used to describe the thickness of frame around a rectangle. It contains four values each corresponding to a side: Left, Top, Right, Bottom.
public struct Thickness : IEquatable<Thickness>
- Implements
Constructors
- Thickness(float)
Initializes a new instance of the Thickness struct with the same value on every side.
- Thickness(float, float)
Initializes a new instance of the Thickness structure with the specified values for the horizontal and vertical sides.
- Thickness(float, float, float, float)
Initializes a new instance of the Thickness struct with the specified values for the each side.
Fields
Properties
- Bottom
Gets or sets the size of the bottom side.
- Horizontal
Gets the combined padding for the right and left edges.
- IsAnyPositive
Returns whether any value on the side is positive (greater than 0).
- IsPositive
Returns whether all values on every side are positive (greater than 0).
- IsUniform
Returns whether all values on every side are equal.
- Left
Gets or sets the size of the left side.
- Right
Gets or sets the size of the right side.
- Top
Gets or sets the size of the top side.
- Vertical
Gets the combined padding for the top and bottom edges.
Methods
- ApplyMin(Thickness)
Apply minimal limits to Left, Top, Right and Bottom using values from the specified Thickness object.
- ApplyMinMax(float, float)
Apply minimal and maximal limits to Left, Top, Right and Bottom using values from the specified Thickness object.
- Equals(Thickness)
Compares this instance of Thickness with another instance.
- Equals(object?)
This function compares to the provided object for type and value equality.
- FromArray(float[]?)
Creates Thickness from array of 1, 2 or 4 values.
- GetFar(bool)
Gets Bottom or Right depending on the
isVertparameter value.
- GetHashCode()
Serves as the default hash function.
- GetSize(bool)
Gets Vertical or Horizontal depending on the
isVertparameter value.
- Inflate(float)
Inflates Left, Top, Right and Bottom on the same value.
- Parse(string)
Parses a Thickness string.
- Reset(bool)
Sets Left, Top, Right and Bottom to 0 if
resetis True.
- ToString()
Converts this Thickness object to a string.
- TryParse(string, out Thickness)
Parses a Thickness string.
- WithBottom(float)
Gets a copy of this object with changed Bottom property.
- WithLeft(float)
Gets a copy of this object with changed Left property.
- WithRight(float)
Gets a copy of this object with changed Right property.
- WithTop(float)
Gets a copy of this object with changed Top property.
Operators
- operator +(Thickness, Thickness)
Overloaded operator to add two Thickness values.
- operator ==(Thickness, Thickness)
Overloaded operator to compare two Thicknesses for equality.
- implicit operator Thickness(int)
Implicit operator conversion from int to Thickness. All fields of thickness instance are assigned with the same int value.
- implicit operator Thickness(float)
Implicit operator conversion from a single value to Thickness. All fields of thickness instance are assigned with the same value.
- implicit operator Thickness((float Left, float Top, float Right, float Bottom))
Implicit operator conversion from tuple with four values to Thickness.
- operator !=(Thickness, Thickness)
Overloaded operator to compare two Thicknesses for inequality.