Rect 结构

定义

描述矩形的宽度、长度和原点。Describes the width, height, and point origin of a rectangle.

public value class Rect : IFormattable
public struct Rect : IFormattable
[System.Security.SecurityCritical]
public struct Rect : IFormattable
type Rect = struct
    interface IFormattable
[<System.Security.SecurityCritical>]
type Rect = struct
    interface IFormattable
Public Structure Rect
Implements IFormattable
继承
属性
实现

注解

此结构表示 Windows 运行时 (WinRT) 结构的 .NET 投影 RectThis struct represents the .NET projection of the Windows Runtime (WinRT) Rect struct. 有关详细信息,请参阅 UWP API 参考中的 RectFor more information, see Rect in the UWP API reference.

构造函数

Rect(Double, Double, Double, Double)

初始化 Rect 结构,此结构具有指定的 x 坐标、y 坐标、宽度和高度。Initializes a Rect struct that has the specified x-coordinate, y-coordinate, width, and height.

Rect(Point, Point)

初始化 Rect 结构,此结构的大小刚好足以包含两个指定点。Initializes a Rect struct that is exactly large enough to contain the two specified points.

Rect(Point, Size)

基于原点和大小初始化 Rect 结构。Initializes a Rect struct based on an origin and size.

属性

Bottom

获取矩形底边的 y 轴值。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

获取一个值,该值指示矩形是否为 Empty 矩形。Gets a value that indicates whether the rectangle is the Empty rectangle.

Left

获取矩形左边的 x 轴值。Gets the x-axis value of the left side of the rectangle.

Right

获取矩形右边的 x 轴值。Gets the x-axis value of the right side of the rectangle.

Top

获取矩形顶边的 y 轴位置。Gets the y-axis position of the top of the rectangle.

Width

获取或设置矩形的宽度。Gets or sets the width of the rectangle.

X

获取或设置矩形左边的 x 轴值。Gets or sets the x-axis value of the left side of the rectangle.

Y

获取或设置矩形顶边的 y 轴值。Gets or sets the y-axis value of the top side of the rectangle.

方法

Contains(Point)

指示 Rect 描述的矩形中是否包含指定点。Indicates whether the rectangle described by the Rect contains the specified point.

Equals(Object)

指示指定对象是否等于当前 RectIndicates whether the specified object is equal to the current Rect.

Equals(Rect)

表示指定的 Rect 是否与当前的 Rect 相等。Indicates whether the specified Rect is equal to the current Rect.

GetHashCode()

创建 Rect 的哈希代码。Creates a hash code for the Rect.

Intersect(Rect)

查找当前 Rect 所表示的矩形与指定的 Rect 所表示的矩形之间的交集,并将结果存储为当前 RectFinds 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()

返回 Rect 结构的字符串表示形式。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)

放大当前 Rect 所表示的矩形,使其刚好足以包含指定点。Expands the rectangle represented by the current Rect exactly enough to contain the specified point.

Union(Rect)

放大当前 Rect 所表示的矩形,使其刚好足以包含指定矩形。Expands the rectangle represented by the current Rect exactly enough to contain the specified rectangle.

运算符

Equality(Rect, Rect)

比较两个 Rect 结构是否相等。Compares two Rect structs for equality.

Inequality(Rect, Rect)

比较两个 Rect 结构是否不相等。Compares two Rect structs for inequality.

显式接口实现

IFormattable.ToString(String, IFormatProvider)

有关此成员的说明,请参见 ToString(String, IFormatProvider)For a description of this member, see ToString(String, IFormatProvider).

适用于