Rect - ahatornn/clforms GitHub Wiki

Rect

ClForms.Common.Rect
Describes the width, height, and location of a rectangular area

public struct Rect
{
    …
    /// Zero-sized Rect
    public static Rect Empty => new Rect(0, 0, 0, 0);
    …
}

Constructors

Syntax Description
Rect(int x, int y, int width, int height) Initialize a new instance with specified parameters
Rect(Point point1, Point point2) Initialize a new instance of the Rect structure, which is large enough to hold two given points
Rect(Size size) Initializes a new instance of Rect structure that has the specified size and coordinates (0,0)

Properties

Name Type Description
Location Point Gets or sets the position of the upper left corner of the rectangle
Size Size Gets or sets the width and height of the rectangle
X int Gets or sets the x-axis value of the left side of the rectangle
Y int Gets or sets the y-axis value of the top side of the rectangle
Width int Gets or sets the width of the rectangle
Height int Gets or sets the height of the rectangle
Left int Gets the x-axis value of the left side of the rectangle
Top int Gets the y-axis value of the top side of the rectangle
Right int Gets the x-axis value of the right side of the rectangle
Bottom int Gets the y-axis value of the bottom side of the rectangle
TopLeft int Gets the position of the upper left corner of the rectangle
TopRight int Gets the position of the upper right corner of the rectangle
BottomLeft int Gets the position of the bottom left corner of the rectangle
BottomRight int Gets the position of the bottom right corner of the rectangle

Methods

Syntax Description
Reduce(Thickness indent) Returns Rect with the area reduced by Thickness
HasEmptyDimension() Indicates an empty dimension along any of the axes Width or Height
Contains(Rect rect) Indicates whether the rectangle includes the specified rectangle
Contains(int x, int y) Indicates whether the rectangle includes the specified point
Contains(Point point) Indicates whether the rectangle includes the specified point