﻿Rectangle Methods

# Rectangle Methods

The Rectangle type exposes the following members.

Methods
NameDescription
Align(Size)
Aligns the rectangle to a grid of the specified gridSize
Align(Int32, Int32)
Aligns the rectangle to a grid of the specified gridWidth and gridHeight
Align(Rectangle, Size)
Aligns the rectangle to a grid of the specified gridSize
Align(Rectangle, Int32, Int32)
Aligns the rectangle to a grid of the specified gridWidth and gridHeight
Ceiling
Converts a floating point rectangle to an integral Rectangle by getting the smallest integral value of X, Y, Width, and Height
Contains(Point)
Gets a value indicating that the specified point is within the bounds of this rectangle
Contains(Rectangle)
Gets a value indicating that the specified rectangle is entirely contained within the bounds of this rectangle
Contains(Int32, Int32)
Gets a value indicating that the specified x and y co-ordinates are within the bounds of this rectangle
Equals(Object)
Compares this rectangle to an object for equality
(Overrides ValueTypeEquals(Object).)
Equals(Rectangle)
Compares this rectangle with the specified other rectangle
FromCenter
Creates a new instance of a Rectangle with a specified center and size
FromSides
Creates a new instance of a RectangleF from the values of the left, top, right and bottom sides
GetHashCode
Gets the hash code for this rectangle
(Overrides ValueTypeGetHashCode.)
Inflate(Size)
Inflates all dimensions of this rectangle by the specified size
Inflate(Int32, Int32)
Inflates all dimensions of this rectangle by the specified width and height
Inflate(Rectangle, Size)
Inflates all dimensions of the rectangle by the specified size
Inflate(Rectangle, Int32, Int32)
Inflates all dimensions of this rectangle by the specified width and height
Intersect(Rectangle)
Intersect the rectangle with the specified rectangle
Intersect(Rectangle, Rectangle)
Intersect the two specified rectangles
Intersects
Gets a value indicating that the specified rectangle overlaps this rectangle
Normalize
Normalizes the rectangle so both the Width and Height are positive, without changing the location of the rectangle
Offset(Point)
Offsets the location of the rectangle by the X and Y values of the specified point
Offset(Size)
Offsets the location of the rectangle by the specified size
Offset(Int32, Int32)
Offsets the location of the rectangle by the specified x and y values
Offset(Rectangle, Point)
Offsets the location of the rectangle by the X and Y values of the specified point
Offset(Rectangle, Size)
Offsets the location of the rectangle by the specified size
Offset(Rectangle, Int32, Int32)
Offsets the location of the rectangle by the specified x and y values
Restrict(Rectangle)
Restricts the rectangle to be within the specified rectangle
Restrict(Size)
Restricts the rectangle to be within the specified size at an X,Y location of 0, 0
Restrict(Point, Size)
Restricts the rectangle to be within the specified location and size
Restrict(Rectangle, Rectangle)
Restricts the rectangle to be within the restrict rectangle
Restrict(Rectangle, Size)
Restricts the rectangle to be within the specified size
Round
Converts a floating point rectangle to an integral Rectangle by rounding the X, Y, Width, and Height.
ToString
Converts this rectangle to a string
(Overrides ValueTypeToString.)
Truncate
Converts a floating point rectangle to an integral Rectangle by truncating the X, Y, Width, and Height values
Union(Rectangle)
Union the rectangle into this instance to encompass both rectangles
Union(Rectangle, Rectangle)
Combines two rectangles into one rectangle that encompasses both
Top