Point.X 속성

정의

X 구조체의 Point 좌표 값을 가져오거나 설정합니다.

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

속성 값

Double

X 구조체의 Point 좌표 값입니다. 기본값은 0입니다.

예제

다음 예제에서는 두 가지 경우를 확인 하는 방법을 보여 줍니다 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

적용 대상

추가 정보