Point.Equality(Point, Point) Point.Equality(Point, Point) Point.Equality(Point, Point) Point.Equality(Point, Point) Operator

정의

Point 개체를 비교합니다.Compares two Point objects. 결과는 두 X 개체의 YPoint 속성 값이 같은지 여부를 지정합니다.The result specifies whether the values of the X and Y properties of the two Point objects are equal.

public:
 static bool operator ==(System::Drawing::Point left, System::Drawing::Point right);
public static bool operator == (System.Drawing.Point left, System.Drawing.Point right);
static member ( = ) : System.Drawing.Point * System.Drawing.Point -> bool
Public Shared Operator == (left As Point, right As Point) As Boolean

매개 변수

left
Point Point Point Point

비교할 Point입니다.A Point to compare.

right
Point Point Point Point

비교할 Point입니다.A Point to compare.

반환

leftrightXY 값이 같으면 true이고, 그렇지 않으면 false입니다.true if the X and Y values of left and right are equal; otherwise, false.

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 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. 사용 하는 방법을 보여 줍니다 합니다 XY 속성입니다.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

적용 대상