Rectangle Structure (Microsoft.Xna.Framework)
Describes a 2D-rectangle.
- C#
- VB
- F#
[DataContractAttribute] [DebuggerDisplayAttribute("{DebugDisplayString,nq}")] [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = -1, Size = -1)] public struct Rectangle : IEquatable<Rectangle>
Syntax for VB is not yet implemented.
Syntax for F# is not yet implemented.
The Rectangle type exposes the following members.
Platforms | Name | Description | |
---|---|---|---|
Rectangle(int, int, int, int) | Creates a new instance of Rectangle struct, with the specified position, width, and height. | ||
Rectangle(Point, Point) | Creates a new instance of Rectangle struct, with the specified location and size. |
Platforms | Name | Description | |
---|---|---|---|
Bottom | Returns the y coordinate of the bottom edge of this Rectangle. | ||
Center | A Point located in the center of this Rectangle. | ||
Empty | Returns a Rectangle with X=0, Y=0, Width=0, Height=0. | ||
IsEmpty | Whether or not this Rectangle has a Width and Height of 0, and a Location of (0, 0). | ||
Left | Returns the x coordinate of the left edge of this Rectangle. | ||
Location | The top-left coordinates of this Rectangle. | ||
Right | Returns the x coordinate of the right edge of this Rectangle. | ||
Size | The width-height coordinates of this Rectangle. | ||
Top | Returns the y coordinate of the top edge of this Rectangle. |
Platforms | Name | Description | |
---|---|---|---|
Contains(Rectangle, out Boolean) | Gets whether or not the provided Rectangle lies within the bounds of this Rectangle. | ||
Contains(Rectangle) | Gets whether or not the provided Rectangle lies within the bounds of this Rectangle. | ||
Contains(Vector2) | Gets whether or not the provided Vector2 lies within the bounds of this Rectangle. | ||
Contains(Point, out Boolean) | Gets whether or not the provided Point lies within the bounds of this Rectangle. | ||
Contains(Vector2, out Boolean) | Gets whether or not the provided Vector2 lies within the bounds of this Rectangle. | ||
Contains(float, float) | Gets whether or not the provided coordinates lie within the bounds of this Rectangle. | ||
Contains(int, int) | Gets whether or not the provided coordinates lie within the bounds of this Rectangle. | ||
Contains(Point) | Gets whether or not the provided Point lies within the bounds of this Rectangle. | ||
Deconstruct | Deconstruction method for Rectangle. | ||
Equals(object) | Compares whether current instance is equal to specified System.Object. (Overrides ValueType.Equals().) | ||
Equals(Rectangle) | Compares whether current instance is equal to specified Rectangle. (Implements IEquatable<T>.Equals().) | ||
GetHashCode | Gets the hash code of this Rectangle. (Overrides ValueType.GetHashCode().) | ||
Inflate(int, int) | Adjusts the edges of this Rectangle by specified horizontal and vertical amounts. | ||
Inflate(float, float) | Adjusts the edges of this Rectangle by specified horizontal and vertical amounts. | ||
Intersect(Rectangle, Rectangle, out Rectangle) | Creates a new Rectangle that contains overlapping region of two other rectangles. | ||
Intersect(Rectangle, Rectangle) | Creates a new Rectangle that contains overlapping region of two other rectangles. | ||
Intersects(Rectangle) | Gets whether or not the other Rectangle intersects with this rectangle. | ||
Intersects(Rectangle, out Boolean) | Gets whether or not the other Rectangle intersects with this rectangle. | ||
Offset(int, int) | Changes the Location of this Rectangle. | ||
Offset(float, float) | Changes the Location of this Rectangle. | ||
Offset(Point) | Changes the Location of this Rectangle. | ||
Offset(Vector2) | Changes the Location of this Rectangle. | ||
ToString | Returns a System.String representation of this Rectangle in the format: {X:[X] Y:[Y] Width:[Width] Height:[Height]} (Overrides ValueType.ToString().) | ||
Union(Rectangle, Rectangle, out Rectangle) | Creates a new Rectangle that completely contains two other rectangles. | ||
Union(Rectangle, Rectangle) | Creates a new Rectangle that completely contains two other rectangles. |
Platforms | Name | Description | |
---|---|---|---|
Equality | Compares whether two Rectangle instances are equal. | ||
Inequality | Compares whether two Rectangle instances are not equal. |
Supported in:
Windows DirectX Desktop
Linux Desktop
Windows OpenGL Desktop
Web
Windows DirectX Desktop
Linux Desktop
Windows OpenGL Desktop
Web