Struct Rectangle
Stores a set of four integers that represent the location and size of a rectangle.
public struct Rectangle
- Inherited Members
Constructors
- Rectangle(Point, Size)
Initializes a new instance of the Rectangle structure with the specified location and size.
- Rectangle(int, int, int, int)
Initializes a new instance of the Rectangle structure with the specified location and size.
Properties
- Bottom
Gets or sets the y-coordinate that is the sum of the Y and Height property values of this Rectangle structure.
- Empty
Gets a new instance of the Rectangle structure that has X, Y, Width and Height values set to zero.
- IsEmpty
Gets a value indicating whether all numeric properties of this Rectangle have values of zero.
- Right
Gets or sets the x-coordinate that is the sum of X and Width property values of this Rectangle structure.
Methods
- Ceiling(RectangleF)
Converts the specified RectangleF structure to a Rectangle structure by rounding the RectangleF values to the next higher integer values.
- Contains(Point)
Determines if the specified point is contained within this Rectangle structure.
- Contains(Rectangle)
Determines if the rectangular region represented by
rect
is entirely contained within this Rectangle structure.
- Contains(int, int)
Determines if the specified point is contained within this Rectangle structure.
- Equals(object)
Tests whether
obj
is a Rectangle structure with the same location and size of this Rectangle structure.
- FromLeftTopRightBottom(int, int, int, int)
Creates a Rectangle structure with the specified edge locations.
- FromPoints(Point, Point)
Creates a new Rectangle from two points specified. Two verticales of the created Rectangle will be equal to the passed
point1
andpoint2
. These would be typically the opposite vertices.
- GetHashCode()
Returns the hash code for this Rectangle structure.
- Inflate(Rectangle, int, int)
Creates and returns an inflated copy of the specified Rectangle structure. The copy is inflated by the specified amount. The original Rectangle structure remains unmodified.
- Inflate(Size)
Inflates this Rectangle by the specified amount.
- Inflate(int, int)
Inflates this Rectangle by the specified amount.
- Intersect(Rectangle)
Replaces this Rectangle with the intersection of itself and the specified Rectangle.
- Intersect(Rectangle, Rectangle)
Returns a third Rectangle structure that represents the intersection of two other Rectangle structures. If there is no intersection, an empty Rectangle is returned.
- IntersectsWith(Rectangle)
Determines if this rectangle intersects with
rect
.
- Normalize()
Normalizes the rectangle by making it's width and height positive, left less than right and top less than bottom.
- Offset(Point)
Adjusts the location of this rectangle by the specified amount.
- Offset(int, int)
Adjusts the location of this rectangle by the specified amount.
- Round(RectangleF)
Converts the specified RectangleF to a Rectangle by rounding the RectangleF values to the nearest integer values.
- ToString()
Converts the attributes of this Rectangle to a human-readable string.
- Truncate(RectangleF)
Converts the specified RectangleF to a Rectangle by truncating the RectangleF values.
- Union(Rectangle, Rectangle)
Gets a Rectangle structure that contains the union of two Rectangle structures.
Operators
- operator ==(Rectangle, Rectangle)
Tests whether two Rectangle structures have equal location and size.
- operator !=(Rectangle, Rectangle)
Tests whether two Rectangle structures differ in location or size.