# Point 結構

## 定義

``public value class Point : IFormattable``
``````[System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))]
public struct Point : IFormattable``````
``````[System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))]
[System.Serializable]
public struct Point : IFormattable``````
``````[<System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))>]
type Point = struct
interface IFormattable``````
``````[<System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))>]
[<System.Serializable>]
type Point = struct
interface IFormattable``````
``````Public Structure Point
Implements IFormattable``````

## 範例

``````// Checks if two Points are equal using the overloaded inequality operator.
private Boolean pointInequalityExample()
{
// Checks if two Points are not equal using the overloaded inequality operator.

// Declaring point1 and initializing x,y values
Point point1 = new Point(10, 5);

// Declaring point2 without initializing x,y values
Point point2 = new Point();

// Boolean to hold the result of the comparison
Boolean areNotEqual;

// assigning values to point2
point2.X = 15;
point2.Y = 40;

// Compare Point structures for equality.
// areNotEqual is True
areNotEqual = (point1 != point2);

return areNotEqual;
}
``````
``````' Checks if two Points are equal using the overloaded inequality operator.
Private Function pointInequalityExample() As Boolean
' Checks if two Points are not equal using the overloaded inequality operator.

' Declaring point1 and initializing x,y values
Dim point1 As New Point(10, 5)

' Declaring point2 without initializing x,y values
Dim point2 As New Point()

' Boolean to hold the result of the comparison
Dim areNotEqual As Boolean

' assigning values to point2
point2.X = 15
point2.Y = 40

' Compare Point structures for equality.
' areNotEqual is True
areNotEqual = (point1 <> point2)

Return areNotEqual

End Function
``````

## 備註

### XAML Attribute UsageXAML Attribute Usage

``````<object property="x,y"/>
-or-
<object property="x y"/>
``````

xx

yy

## 建構函式

 建立新的 Point 結構，包含指定的座標。Creates a new Point structure that contains the specified coordinates.

## 屬性

 取得或設定這個 X 結構的 Point 座標。Gets or sets the X-coordinate value of this Point structure. 取得或設定這個 Y 的 Point 座標值。Gets or sets the Y-coordinate value of this Point.

## 方法

 將 Vector 加入至 Point，並傳回結果做為 Point 結構。Adds a Vector to a Point and returns the result as a Point structure. 判斷指定的 Object 是否為 Point，以及它包含的座標是否與這個 Point 相同。Determines whether the specified Object is a Point and whether it contains the same coordinates as this Point. 比較兩個 Point 結構是否相等。Compares two Point structures for equality. 比較兩個 Point 結構是否相等。Compares two Point structures for equality. 傳回這個 Point 的雜湊程式碼。Returns the hash code for this Point. 使用指定的 Point 結構轉換指定的 Matrix 結構。Transforms the specified Point structure by the specified Matrix structure. 將點的 X 和 Y 座標位移指定的數量。Offsets a point's X and Y coordinates by the specified amounts. 從指定的 Point 建構 String。Constructs a Point from the specified String. 從指定的 Point 減去另一個指定的 Point 並以 Vector 傳回差數。Subtracts the specified Point from another specified Point and returns the difference as a Vector. 從指定的 Vector 減去指定的 Point 並傳回產生的 Point。Subtracts the specified Vector from the specified Point and returns the resulting Point. 建立這個 String 的 Point 表示。Creates a String representation of this Point. 建立這個 String 的 Point 表示。Creates a String representation of this Point.

## 運算子

 依指定的 Point 平移指定的 Vector，然後傳回結果。Translates the specified Point by the specified Vector and returns the result. 比較兩個 Point 結構是否相等。Compares two Point structures for equality. 建立 Size 結構，其 Width 等於這個點的 X 值且 Height 等於這個點的 Y 值。Creates a Size structure with a Width equal to this point's X value and a Height equal to this point's Y value. 建立 Vector 結構，其 X 值等於這個點的 X 值且 Y 值等於這個點的 Y 值。Creates a Vector structure with an X value equal to the point's X value and a Y value equal to the point's Y value. 比較兩個 Point 結構是否相等。Compares two Point structures for inequality. 依指定的 Point 轉換指定的 Matrix。Transforms the specified Point by the specified Matrix. 從指定的 Point 減去另一個指定的 Point 並以 Vector 傳回差數。Subtracts the specified Point from another specified Point and returns the difference as a Vector. 從指定的 Vector 減去指定的 Point 並傳回產生的 Point。Subtracts the specified Vector from the specified Point and returns the resulting Point.

## 明確介面實作

 這個成員支援 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基礎結構，但是您不可以從程式碼直接使用它。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. 如需這個成員的說明，請參閱 ToString(String, IFormatProvider)。For a description of this member, see ToString(String, IFormatProvider).