Point 구조체

정의

2차원 평면에 있는 한 점을 정의하는 정수 X 및 Y 좌표 순서 쌍을 나타냅니다.

public value class Point : IEquatable<System::Drawing::Point>
public value class Point
[System.ComponentModel.TypeConverter("System.Drawing.PointConverter, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public struct Point : IEquatable<System.Drawing.Point>
public struct Point
public struct Point : IEquatable<System.Drawing.Point>
[System.ComponentModel.TypeConverter(typeof(System.Drawing.PointConverter))]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public struct Point
[<System.ComponentModel.TypeConverter("System.Drawing.PointConverter, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
type Point = struct
type Point = struct
[<System.ComponentModel.TypeConverter(typeof(System.Drawing.PointConverter))>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type Point = struct
Public Structure Point
Implements IEquatable(Of Point)
Public Structure Point
상속
특성
구현

예제

다음 코드 예제에서는 이러한 형식에 대해 정의된 여러 오버로드된 연산자를 사용하여 점과 크기를 만듭니다. 또한 클래스를 사용하는 방법을 보여 줍니다 SystemPens .

이 예제는 Windows Forms 사용하도록 설계되었습니다. 라는 subtractButton형식을 포함하는 폼을 Button 만듭니다. 코드를 양식에 붙여넣고 양식의 Paint 이벤트 처리 메서드에서 메서드를 호출 CreatePointsAndSizes 하여 로 PaintEventArgs전달 e 합니다.

void CreatePointsAndSizes( PaintEventArgs^ e )
{
   // Create the starting point.
   Point startPoint = Point(subtractButton->Size);
   
   // Use the addition operator to get the end point.
   Point endPoint = startPoint + System::Drawing::Size( 140, 150 );
   
   // Draw a line between the points.
   e->Graphics->DrawLine( SystemPens::Highlight, startPoint, endPoint );
   
   // Convert the starting point to a size and compare it to the
   // subtractButton size.  
   System::Drawing::Size buttonSize = (System::Drawing::Size)startPoint;
   if ( buttonSize == subtractButton->Size )
   {
      e->Graphics->DrawString( "The sizes are equal.", gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), Brushes::Indigo, 10.0F, 65.0F );
   }
}
private void CreatePointsAndSizes(PaintEventArgs e)
{

    // Create the starting point.
    Point startPoint = new Point(subtractButton.Size);

    // Use the addition operator to get the end point.
    Point endPoint = startPoint + new Size(140, 150);

    // Draw a line between the points.
    e.Graphics.DrawLine(SystemPens.Highlight, startPoint, endPoint);

    // Convert the starting point to a size and compare it to the
    // subtractButton size.  
    Size buttonSize = (Size)startPoint;
    if (buttonSize == subtractButton.Size)

        // If the sizes are equal, tell the user.
    {
        e.Graphics.DrawString("The sizes are equal.", 
            new Font(this.Font, FontStyle.Italic), 
            Brushes.Indigo, 10.0F, 65.0F);
    }
}
Private Sub CreatePointsAndSizes(ByVal e As PaintEventArgs)

    ' Create the starting point.
    Dim startPoint As New Point(subtractButton.Size)

    ' Use the addition operator to get the end point.
    Dim endPoint As Point = Point.op_Addition(startPoint, _
        New Size(140, 150))

    ' Draw a line between the points.
    e.Graphics.DrawLine(SystemPens.Highlight, startPoint, endPoint)

    ' Convert the starting point to a size and compare it to the
    ' subtractButton size.  
    Dim buttonSize As Size = Point.op_Explicit(startPoint)
    If (Size.op_Equality(buttonSize, subtractButton.Size)) Then

        ' If the sizes are equal, tell the user.
        e.Graphics.DrawString("The sizes are equal.", _
            New Font(Me.Font, FontStyle.Italic), _
            Brushes.Indigo, 10.0F, 65.0F)
    End If

End Sub

설명

를 로 Point 변환하려면 를 PointF사용합니다 Implicit.

생성자

Point(Int32)

정수 값으로 지정된 좌표를 사용하여 Point 구조체의 새 인스턴스를 초기화합니다.

Point(Int32, Int32)

지정된 좌표를 사용하여 Point 구조체의 새 인스턴스를 초기화합니다.

Point(Size)

SizePoint 구조체의 새 인스턴스를 초기화합니다.

필드

Empty

PointX 값이 0으로 설정된 Y를 나타냅니다.

속성

IsEmpty

Point가 비어 있는지 여부를 나타내는 값을 가져옵니다.

X

Point의 x좌표를 가져오거나 설정합니다.

Y

Point의 y좌표를 가져오거나 설정합니다.

메서드

Add(Point, Size)

지정된 Size를 지정된 Point에 더합니다.

Ceiling(PointF)

PointF의 값을 정수 값으로 올림하여 지정된 PointPointF로 변환합니다.

Equals(Object)

이 포인트 인스턴스에 지정된 개체와 동일한 좌표가 포함되는지를 지정합니다.

Equals(Point)

이 포인트 인스턴스에 다른 포인트와 동일한 좌표가 포함되는지를 지정합니다.

GetHashCode()

Point의 해시 코드를 반환합니다.

Offset(Int32, Int32)

Point 를 지정된 크기만큼 변환합니다.

Offset(Point)

Point를 지정된 Point만큼 변환합니다.

Round(PointF)

PointF 값을 가장 가까운 정수로 반올림하여 지정된 PointPointF 개체로 변환합니다.

Subtract(Point, Size)

지정된 Size에서 지정된 Point를 뺀 결과를 반환합니다.

ToString()

Point를 사람이 인식할 수 있는 문자열로 변환합니다.

Truncate(PointF)

PointF의 값을 버림으로써 지정된 PointPointF로 변환합니다.

연산자

Addition(Point, Size)

지정된 PointSize를 변환합니다.

Equality(Point, Point)

두 개의 Point 개체를 비교합니다. 결과는 두 X 개체의 YPoint 속성 값이 같은지 여부를 지정합니다.

Explicit(Point to Size)

지정된 Point 구조체를 Size 구조체로 변환합니다.

Implicit(Point to PointF)

지정된 Point 구조체를 PointF 구조체로 변환합니다.

Inequality(Point, Point)

두 개의 Point 개체를 비교합니다. 결과는 두 X 개체의 Y 또는 Point 속성 값이 다른지 여부를 지정합니다.

Subtraction(Point, Size)

지정된 Point의 음수가 Size를 변환합니다.

적용 대상