Class Thickness
Describes the thickness of a frame around a rectangle. Four int values describe the Left, Top, Right, and Bottom sides of the rectangle, respectively.
public class Thickness : IEquatable<Thickness>
- Inheritance
-
Thickness
- Implements
- Inherited Members
Remarks
Use the helper API (GetInside(Rectangle) to get the rectangle describing the insides of the frame, with the thickness widths subtracted.
Use the helper API (Draw(Rectangle, string) to draw the frame with the specified thickness.
Constructors
- Thickness()
Initializes a new instance of the Thickness class with all widths set to 0.
- Thickness(int)
Initializes a new instance of the Thickness class with a uniform width to each side.
- Thickness(int, int, int, int)
Initializes a new instance of the Thickness class that has specific widths applied to each side of the rectangle.
Fields
- Bottom
Gets or sets the width of the lower side of the rectangle.
- Left
Gets or sets the width of the left side of the rectangle.
- Right
Gets or sets the width of the right side of the rectangle.
- Top
Gets or sets the width of the upper side of the rectangle.
Properties
- Empty
Gets an empty thickness.
- Horizontal
Gets the total width of the left and right sides of the rectangle. Sets the width of the left and rigth sides of the rectangle to half the specified value.
- Vertical
Gets the total height of the top and bottom sides of the rectangle. Sets the height of the top and bottom sides of the rectangle to half the specified value.
Methods
- Add(Thickness)
Adds the thickness widths of another Thickness to the current Thickness, returning a new Thickness.
- Contains(in Rectangle, in Point)
Gets whether the specified coordinates lie within the thickness (inside the bounding rectangle but outside the rectangle described by GetInside(Rectangle).
- Draw(Rectangle, string)
Draws the Thickness rectangle with an optional diagnostics label.
- Equals(object)
Determines whether the specified object is equal to the current object.
- Equals(Thickness)
Indicates whether the current object is equal to another object of the same type.
- GetHashCode()
Serves as the default hash function.
- GetInside(Rectangle)
Returns a rectangle describing the location and size of the inside area of
rect
with the thickness widths subtracted. The height and width of the returned rectangle will never be less than 0.
- ToString()
Returns the thickness widths of the Thickness formatted as a string.
Operators
- operator +(Thickness, Thickness)
Adds the thickness widths of another Thickness to another Thickness.