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 是否等於目前 RectIndicates 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).

適用於