Freigeben über


Rectangle Structure

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Defines a rectangle.

Namespace:  Microsoft.Xna.Framework
Assembly:  Microsoft.Xna.Framework (in Microsoft.Xna.Framework.dll)

Syntax

'Declaration
Public Structure Rectangle
public struct Rectangle

The Rectangle type exposes the following members.

Constructors

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

Top

Properties

  Name Description
Public property Bottom Gets the y-coordinate of the bottom of the rectangle.
Public propertyStatic member Empty Gets 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 Gets the x-coordinate of the left side of the rectangle.
Public property Right Gets the x-coordinate of the right side of the rectangle.
Public property Top Gets the y-coordinate of the top of the rectangle.

Top

Methods

  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the Rectangle. (Overrides ValueType.Equals(Object).)
Public method Equals(Rectangle) Determines whether the current instance is equal to a specified object.
Public method GetHashCode Gets the hash code for this object. (Overrides ValueType.GetHashCode().)
Public method ToString Retrieves a string representation of the current object. (Overrides ValueType.ToString().)

Top

Operators

  Name Description
Public operatorStatic member Equality Compares two rectangles for equality.
Public operatorStatic member Inequality Compares two rectangles for inequality.

Top

Fields

  Name Description
Public field Height Specifies the x-coordinate 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.

Top

Version Information

Silverlight

Supported in: 5

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.