Point.X Point.X Point.X Point.X Property

定義

この X 構造体の Point 座標値を取得または設定します。Gets or sets the X-coordinate value of this Point structure.

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

プロパティ値

この X 構造体の Point 座標値。The X-coordinate value of this Point structure. 既定値は0します。The default value is 0.

次の例は、2 つの場合にチェックする方法を示しますPoint構造体が等しくないです。The following example shows how to check if two Point structures are not equal. 値を割り当てる方法を説明も、Point構造体が宣言されているとき、および構造体が宣言された構造体します。It also illustrates how to assign values to a Point structure when the structure is being declared and after the structure has been declared.

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

適用対象

こちらもご覧ください