Point 結構
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示二維空間中的 x 和 Y 座標組。
public value class Point : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))]
[System.Serializable]
public struct Point : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))]
public struct Point : IFormattable
[<System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))>]
[<System.Serializable>]
type Point = struct
interface IFormattable
[<System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))>]
type Point = struct
interface IFormattable
Public Structure Point
Implements IFormattable
- 繼承
- 屬性
- 實作
範例
以下範例說明如何檢查兩個 Point 結構是否不相等。 同時說明在結構宣告時及宣告後,如何為結構指派值 Point 。
// 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 中,a X 與 值之間的YPoint分隔符可以是逗號或空格。
有些文化可能會用逗號作為小數分隔符,而不是時代字元。 大多數 XAML 處理器實作中,不變文化的 XAML 處理預設為 en-US,且預期週期為十進位分隔符。 如果在 XAML 中指定 a Point ,應該避免用逗號作為十進位分隔符,因為這會和屬性 Point 值轉換成 X and Y components 的字串類型產生衝突。
XAML 屬性使用方式
<object property="x,y"/>
-or-
<object property="x y"/>
XAML 值
x 這個 的 x 座標 Point。
y 這個的 y 座標 Point。
建構函式
| 名稱 | Description |
|---|---|
| Point(Double, Double) |
建立 Point 包含指定座標的新結構。 |
屬性
| 名稱 | Description |
|---|---|
| X | |
| Y |
方法
| 名稱 | Description |
|---|---|
| Add(Point, Vector) | |
| Equals(Object) | |
| Equals(Point, Point) |
比較兩種 Point 平等結構。 |
| Equals(Point) |
比較兩種 Point 平等結構。 |
| GetHashCode() |
回傳此 Point的雜湊碼。 |
| Multiply(Point, Matrix) | |
| Offset(Double, Double) | |
| Parse(String) | |
| Subtract(Point, Point) | |
| Subtract(Point, Vector) | |
| ToString() | |
| ToString(IFormatProvider) |
操作員
明確介面實作
| 名稱 | Description |
|---|---|
| IFormattable.ToString(String, IFormatProvider) |
此成員支援 Windows Presentation Foundation(WPF)基礎架構,並非直接從您的程式碼中使用。 關於此成員的描述,請參見 ToString(String, IFormatProvider)。 |