Rectangle Members

The following tables list the members exposed by the Rectangle type.

Public Constructors

Name Description
Public Method Rectangle Initializes a new instance of Rectangle.

Public Fields

Name Description
Public Field Height Specifies the height of the rectangle.
Public Field Width Specifies the width of the rectangle.
Public Field X Specifies the x-coordinate of the rectangle.
Public Field Y Specifies the y-coordinate of the rectangle.

Public Properties

Name Description
Public Property Bottom Returns the y-coordinate of the bottom of the rectangle.
Public Property Center Gets the Point that specifies the center of the rectangle.
Public Property Static Empty Returns a Rectangle with all of its values set to zero.
Public Property IsEmpty Gets a value that indicates whether the Rectangle is empty.
Public Property Left Returns the x-coordinate of the left side of the rectangle.
Public Property Location Gets or sets the upper-left value of the Rectangle.
Public Property Right Returns the x-coordinate of the right side of the rectangle.
Public Property Top Returns the y-coordinate of the top of the rectangle.

Public Methods

Name Description
Public Method Contains Overloaded. Determines whether this Rectangle contains a specified point or Rectangle.
Public Method Equals Overloaded. Returns a value that indicates whether the current instance is equal to a specified object.
Public Method GetHashCode Gets the hash code for this object.
Public Method GetType (Inherited from Object.)
Public Method Inflate Pushes the edges of the Rectangle out by the horizontal and vertical values specified.
Public Method Static Intersect Overloaded. Creates a Rectangle defining the area where one rectangle overlaps another rectangle.
Public Method Intersects Overloaded. Determines whether a specified Rectangle intersects with this Rectangle.
Public Method Offset Overloaded. Changes the position of the Rectangle.
Public Method Static op_Equality Compares two rectangles for equality.
Public Method Static op_Inequality Compares two rectangles for inequality.
Public Method ToString Retrieves a string representation of the current object.
Public Method Static Union Overloaded. Creates a new Rectangle that exactly contains two other rectangles.

Protected Methods

Name Description
Protected Method Finalize (Inherited from Object.)
Protected Method MemberwiseClone (Inherited from Object.)

See Also

Reference

Rectangle Structure
Microsoft.Xna.Framework Namespace