# Rect 結構

## 定義

``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``````

## 建構函式

 初始化 Rect 結構，這個結構具有指定的 X 座標、Y 座標、寬度及高度。Initializes a Rect struct that has the specified x-coordinate, y-coordinate, width, and height. 初始化 Rect 結構，這個結構剛好足以包含兩個指定的點。Initializes a Rect struct that is exactly large enough to contain the two specified points. 根據原點與大小，初始化 Rect 結構。Initializes a Rect struct based on an origin and size.

## 屬性

 取得矩形底端的 Y 軸值。Gets the y-axis value of the bottom of the rectangle. 取得特殊值，這個值表示沒有位置或區域的矩形。Gets a special value that represents a rectangle with no position or area. 取得或設定矩形的高度。Gets or sets the height of the rectangle. 取得值，這個值表示矩形是否為 Empty 矩形。Gets a value that indicates whether the rectangle is the Empty rectangle. 取得矩形左側的 X 軸值。Gets the x-axis value of the left side of the rectangle. 取得矩形右側的 X 軸值。Gets the x-axis value of the right side of the rectangle. 取得矩形頂端的 Y 軸位置。Gets the y-axis position of the top of the rectangle. 取得或設定矩形的寬度。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.

## 方法

 指出 Rect 所描述矩形是否包含指定的點。Indicates whether the rectangle described by the Rect contains the specified point. 指出指定的物件是否等同於目前 Rect。Indicates whether the specified object is equal to the current Rect. 指出指定的 Rect 是否等於目前 Rect。Indicates whether the specified Rect is equal to the current Rect. 建立 Rect 的雜湊碼。Creates a hash code for the Rect. 尋找目前 Rect 所代表矩形和所指定 Rect 代表之矩形的交集，並將結果儲存為目前的 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. 傳回 Rect 結構的字串表示。Returns a string representation of the Rect struct. 使用指定的格式提供者，傳回矩形的字串表示。Returns a string representation of the rectangle by using the specified format provider. 將目前 Rect 所代表矩形展開至剛好可以包含指定的點。Expands the rectangle represented by the current Rect exactly enough to contain the specified point. 將目前 Rect 所代表矩形展開至剛好可以包含指定的矩形。Expands the rectangle represented by the current Rect exactly enough to contain the specified rectangle.

## 運算子

 比較兩個 Rect 結構是否相等。Compares two Rect structs for equality. 比較兩個 Rect 結構是否不相等。Compares two Rect structs for inequality.

## 明確介面實作

 如需這個成員的說明，請參閱 ToString(String, IFormatProvider)。For a description of this member, see ToString(String, IFormatProvider).