Point.Y プロパティ

定義

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

public:
 property double Y { double get(); void set(double value); };
public double Y { get; set; }
member this.Y : double with get, set
Public Property Y As Double

プロパティ値

Double

この Y 構造体の Point 座標値。 既定値は 0 です。

次の例は、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

適用対象

こちらもご覧ください