# Point.XPoint.XPoint.XPoint.X Property

## Определение

Возвращает или задает координату Х точки Point.Gets or sets the x-coordinate of this Point.

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

#### Значение свойства

Координата Х точки Point.The x-coordinate of this Point.

## Примеры

В следующем примере кода демонстрируется использование Equality оператора и Point создание из Size или двух целых чисел.The following code example demonstrates how to use the Equality operator and how to construct a Point from a Size or two integers. В нем также показано, как использовать X свойства Y и.It also demonstrates how to use the X and Y properties. Этот пример предназначен для использования с Windows Forms.This example is designed to be used with Windows Forms. Вставьте код в форму, содержащую кнопку с именем `Button1`, и `Button1_Click` свяжите Click метод с событием кнопки.Paste the code into a form that contains a button named `Button1`, and associate the `Button1_Click` method with the button's Click event.

``````private:
void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
// Construct a new Point with integers.
Point Point1 = Point(100,100);

// Create a Graphics object.
Graphics^ formGraphics = this->CreateGraphics();

// Construct another Point, this time using a Size.
Point Point2 = Point(System::Drawing::Size( 100, 100 ));

// Call the equality operator to see if the points are equal,
// and if so print out their x and y values.
if ( Point1 == Point2 )
{
array<Object^>^temp0 = {Point1.X,Point2.X,Point1.Y,Point2.Y};
formGraphics->DrawString( String::Format( "Point1.X: "
"{0},Point2.X: {1}, Point1.Y: {2}, Point2.Y {3}", temp0 ), this->Font, Brushes::Black, PointF(10,70) );
}
}
``````
``````private void Button1_Click(System.Object sender, System.EventArgs e)
{

// Construct a new Point with integers.
Point Point1 = new Point(100, 100);

// Create a Graphics object.
Graphics formGraphics = this.CreateGraphics();

// Construct another Point, this time using a Size.
Point Point2 = new Point(new Size(100, 100));

// Call the equality operator to see if the points are equal,
// and if so print out their x and y values.
if (Point1 == Point2)
{
formGraphics.DrawString(String.Format("Point1.X: " +
"{0},Point2.X: {1}, Point1.Y: {2}, Point2.Y {3}",
new object[]{Point1.X, Point2.X, Point1.Y, Point2.Y}),
this.Font, Brushes.Black, new PointF(10, 70));
}

}
``````
``````Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

' Construct a new Point with integers.
Dim Point1 As New Point(100, 100)

' Create a Graphics object.
Dim formGraphics As Graphics = Me.CreateGraphics()

' Construct another Point, this time using a Size.
Dim Point2 As New Point(New Size(100, 100))

' Call the equality operator to see if the points are equal,
' and if so print out their x and y values.
If (Point.op_Equality(Point1, Point2)) Then
formGraphics.DrawString(String.Format("Point1.X: " & _
"{0},Point2.X: {1}, Point1.Y: {2}, Point2.Y {3}", _
New Object() {Point1.X, Point2.X, Point1.Y, Point2.Y}), _
Me.Font, Brushes.Black, New PointF(10, 70))
End If

End Sub
``````