Point 構造体

定義

2 次元空間での 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
継承
属性
実装

次の例は、2 つの 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 では、XY値とPoint値の間の区切り記号には、コンマまたはスペースを指定できます。

カルチャによっては、ピリオド文字の代わりにコンマ文字を 10 進区切り記号として使用する場合があります。 インバリアント カルチャの XAML 処理は、ほとんどの XAML プロセッサ実装で既定で en-US され、ピリオドは 10 進区切り記号であると想定されます。 XAML で Point を指定する場合は、コンマ文字を 10 進区切り記号として使用しないでください。これは、 Point 属性値を X および Y コンポーネントに変換する文字列型と競合するためです。

XAML 属性の使用法

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

XAML 値

x この Pointの x 座標。

y この Pointの y 座標。

コンストラクター

名前 説明
Point(Double, Double)

指定した座標を含む新しい Point 構造体を作成します。

プロパティ

名前 説明
X

このX構造体のPoint座標値を取得または設定します。

Y

このYPoint座標値を取得または設定します。

メソッド

名前 説明
Add(Point, Vector)

VectorPointを追加し、結果をPoint構造体として返します。

Equals(Object)

指定した ObjectPoint かどうか、および指定した Pointと同じ座標が含まれているかどうかを判断します。

Equals(Point, Point)

2 つの Point 構造体の等価性を比較します。

Equals(Point)

2 つの Point 構造体の等価性を比較します。

GetHashCode()

この Pointのハッシュ コードを返します。

Multiply(Point, Matrix)

指定したPoint構造体によって、指定したMatrix構造体を変換します。

Offset(Double, Double)

ポイントの X 座標と Y 座標を指定した量でオフセットします。

Parse(String)

指定したPointからStringを構築します。

Subtract(Point, Point)

指定した別のPointから指定したPointを減算し、差をVectorとして返します。

Subtract(Point, Vector)

指定したVectorから指定したPointを減算し、結果のPointを返します。

ToString()

このStringPoint表現を作成します。

ToString(IFormatProvider)

このStringPoint表現を作成します。

演算子

名前 説明
Addition(Point, Vector)

指定したPointによって指定したVectorを変換し、結果を返します。

Equality(Point, Point)

2 つの Point 構造体の等価性を比較します。

Explicit(Point to Size)

このポイントのSize値と等しいWidthと、このポイントのX値と等しいHeightを持つY構造体を作成します。

Explicit(Point to Vector)

ポイントのVector値と等しいX値とポイントのX値と等しいY値を持つY構造体を作成します。

Inequality(Point, Point)

2 つの Point 構造体の不等値を比較します。

Multiply(Point, Matrix)

指定したPointによって指定したMatrixを変換します。

Subtraction(Point, Point)

指定した別のPointから指定したPointを減算し、差をVectorとして返します。

Subtraction(Point, Vector)

指定したVectorから指定したPointを減算し、結果のPointを返します。

明示的なインターフェイスの実装

名前 説明
IFormattable.ToString(String, IFormatProvider)

このメンバーは、Windows Presentation Foundation (WPF) インフラストラクチャをサポートしており、コードから直接使用するためのものではありません。 このメンバーの説明については、 ToString(String, IFormatProvider)を参照してください。

適用対象