Rediger

Del via


Rect Struct

Definition

Describes the width, height, and point origin of a rectangle.

public value class Rect : IFormattable
[System.Security.SecurityCritical]
public struct Rect : IFormattable
[<System.Security.SecurityCritical>]
type Rect = struct
    interface IFormattable
Public Structure Rect
Implements IFormattable
Inheritance
Attributes
Implements

Remarks

This struct represents the .NET projection of the Windows Runtime (WinRT) Rect struct. For more information, see Rect in the UWP API reference.

Constructors

Rect(Double, Double, Double, Double)

Initializes a Rect struct that has the specified x-coordinate, y-coordinate, width, and height.

Rect(Point, Point)

Initializes a Rect struct that is exactly large enough to contain the two specified points.

Rect(Point, Size)

Initializes a Rect struct based on an origin and size.

Properties

Bottom

Gets the y-axis value of the bottom of the rectangle.

Empty

Gets a special value that represents a rectangle with no position or area.

Height

Gets or sets the height of the rectangle.

IsEmpty

Gets a value that indicates whether the rectangle is the Empty rectangle.

Left

Gets the x-axis value of the left side of the rectangle.

Right

Gets the x-axis value of the right side of the rectangle.

Top

Gets the y-axis position of the top of the rectangle.

Width

Gets or sets the width of the rectangle.

X

Gets or sets the x-axis value of the left side of the rectangle.

Y

Gets or sets the y-axis value of the top side of the rectangle.

Methods

Contains(Point)

Indicates whether the rectangle described by the Rect contains the specified point.

Equals(Object)

Indicates whether the specified object is equal to the current Rect.

Equals(Rect)

Indicates whether the specified Rect is equal to the current Rect.

GetHashCode()

Creates a hash code for the Rect.

Intersect(Rect)

Finds the intersection of the rectangle represented by the current Rect and the rectangle represented by the specified Rect, and stores the result as the current Rect.

ToString()

Returns a string representation of the Rect struct.

ToString(IFormatProvider)

Returns a string representation of the rectangle by using the specified format provider.

Union(Point)

Expands the rectangle represented by the current Rect exactly enough to contain the specified point.

Union(Rect)

Expands the rectangle represented by the current Rect exactly enough to contain the specified rectangle.

Operators

Equality(Rect, Rect)

Compares two Rect structs for equality.

Inequality(Rect, Rect)

Compares two Rect structs for inequality.

Explicit Interface Implementations

IFormattable.ToString(String, IFormatProvider)

For a description of this member, see ToString(String, IFormatProvider).

Applies to

See also