System.Drawing.Rectangle
Summary
Stores a set of four integers that represent the location and size of a rectangle.
Defined in Rectangle.js
Constructors
System.Drawing.Rectangle(<Point> location, <Size> size)
Initializes a new instance of the Rectangle class with the specified location and size.
Parameters
location - A Point that represents the upper-left corner of the rectangular region.
size - A Size that represents the width and height of the rectangular region.
Methods
-
Object Clone()
Creates a new instance of a Rectangle with the same values as this Rectangle.
-
Boolean Contains(<Point> pt)
Determines if the specified point is contained within the rectangular region defined by this Rectangle.
Return Values
True if the specified point is contained within this Rectangle; otherwise false.
-
Boolean Equals(<Object> obj)
Tests whether obj is a Rectangle with the same location and size of this Rectangle.
Parameters
obj - The Object to test.
Return Values
This method returns true if obj is a Rectangle and its X, Y, Width, and Height properties are equal to the corresponding properties of this Rectangle; otherwise, false.
-
Object GetBottom()
Gets the y-coordinate of the bottom edge of this Rectangle structure.
-
Object GetHeight()
Gets the height of this Rectangle.
-
Object GetLeft()
Gets the x-coordinate of the left edge of this Rectangle.
-
Object GetRight()
Gets the x-coordinate of the right edge of this Rectangle.
-
Object GetTop()
Gets the y-coordinate of the top edge of this Rectangle.
-
Object GetWidth()
Gets the width of this Rectangle structure.
-
Object GetX()
Gets the x-coordinate of the upper-left corner of this Rectangle.
-
Object GetY()
Gets the y-coordinate of the upper-left corner of this Rectangle.
-
void Inflate(<Size> size)
Inflates this Rectangle by the specified amount.
This method inflates this rectangle, not a copy of it. The inflation along an axis is in two directions (minus direction and plus direction). For example, if a 50 by 50 rectangle is inflated by 50 in the x-axis, the resultant rectangle will be 150 units long (the original 50, the 50 in the minus direction, and the 50 in the plus direction) maintaining the rectangle's geometric center.
Parameters
size - The amount to inflate this rectangle.
-
void Intersect(<Rectangle> rect)
Replaces this Rectangle with the intersection of itself and the specified Rectangle.
Parameters
rect - The Rectangle with which to intersect.
-
Boolean IntersectsWith(<Rectangle> rect)
Determines if this rectangle intersects with the specified Rectangle.
Parameters
rect - The Rectangle to test.
Return Values
True if there is any intersection; otherwise false.
-
Boolean IsEmpty()
Tests whether all numeric properties of this Rectangle have values of zero.
Return Values
True if the Width, Height, X, and Y properties of this Rectangle all have values of zero; otherwise, false.
-
void Offset(<Point> pos)
Adjusts the location of this rectangle by the specified amount.
This method adjusts the location of the upper-left corner horizontally by the x-coordinate of the specified point, and vertically by the y-coordinate of the specified point.
Parameters
pos - Amount to offset the location.
-
void SetHeight(height)
Sets the height of this Rectangle.
-
void SetWidth(width)
Sets the width of this Rectangle.
-
void SetX(x)
Sets the x-coordinate of the upper-left corner of this Rectangle.
-
void SetY(y)
Sets the y-coordinate of the upper-left corner of this Rectangle.
-
String ToString()
Converts the attributes of this Rectangle to a human-readable string.
Return Values
A string that contains the position, width, and height of this Rectangle.
-
static Rectangle FromLTRB(<Int> left, <Int> top, <Int> right, <Int> bottom)
Creates a Rectangle with the specified edge locations.
Parameters
left - The x-coordinate of the upper-left corner of this Rectangle.
top - The y-coordinate of the upper-left corner of this Rectangle.
right - The x-coordinate of the lower-right corner of this Rectangle.
bottom - The y-coordinate of the lower-right corner of this Rectangle.
Return Values
A Rectangle with the specified upper-left and lower-right corners.
-
static Rectangle Union(<Rectangle> a, <Rectangle> b)
Gets a Rectangle that contains the union of two Rectangles.
Parameters
a - A Rectangle to union.
b - A Rectangle to union.
Return Values
A Rectangle that bounds the union of the two Rectangle structures.