Point 생성자

정의

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

오버로드

Point(Size)

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

Point(Int32)

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

Point(Int32, Int32)

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

Point(Size)

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

public:
 Point(System::Drawing::Size sz);
public Point (System.Drawing.Size sz);
new System.Drawing.Point : System.Drawing.Size -> System.Drawing.Point
Public Sub New (sz As Size)

매개 변수

sz
Size

Size의 좌표를 지정하는 Point입니다.

예제

다음 코드 예제에서는 연산자를 사용 Equality 하는 방법 및 또는 두 정수에서 를 PointSize 생성 하는 방법을 보여 줍니다. 또한 및 Y 속성을 사용하는 X 방법을 보여 줍니다. 이 예제는 Windows Forms 사용하도록 설계되었습니다. 라는 단추 Button1가 포함된 양식에 코드를 붙여넣고 메서드를 Button1_Click 단추의 Click 이벤트와 연결합니다.

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

적용 대상

Point(Int32)

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

public:
 Point(int dw);
public Point (int dw);
new System.Drawing.Point : int -> System.Drawing.Point
Public Sub New (dw As Integer)

매개 변수

dw
Int32

Point의 좌표를 지정하는 32비트 정수입니다.

예제

다음 코드 예제를 사용 Point 하는 방법에 설명 합니다 및 Size.Size 생성자 및 System.Drawing.ContentAlignment 열거형입니다. 이 예제를 실행하려면 이 코드를 라는 Label1레이블이 포함된 Windows Form에 붙여넣고 폼의 생성자에서 메서드를 호출 InitializeLabel1 합니다.

void InitializeLabel1()
{
   // Set a border.
   Label1->BorderStyle = BorderStyle::FixedSingle;
   
   // Set the size, constructing a size from two integers.
   Label1->Size = System::Drawing::Size( 100, 50 );
   
   // Set the location, constructing a point from a 32-bit integer
   // (using hexadecimal).
   Label1->Location = Point(0x280028);
   
   // Set and align the text on the lower-right side of the label.
   Label1->TextAlign = ContentAlignment::BottomRight;
   Label1->Text = "Bottom Right Alignment";
}
private void InitializeLabel1()
{
    // Set a border.
    Label1.BorderStyle = BorderStyle.FixedSingle;

    // Set the size, constructing a size from two integers.
    Label1.Size = new Size(100, 50);

    // Set the location, constructing a point from a 32-bit integer
    // (using hexadecimal).
    Label1.Location = new Point(0x280028);

    // Set and align the text on the lower-right side of the label.
    Label1.TextAlign = ContentAlignment.BottomRight;
    Label1.Text = "Bottom Right Alignment";
}
Private Sub InitializeLabel1()

    ' Set a border.
    Label1.BorderStyle = BorderStyle.FixedSingle

    ' Set the size, constructing a size from two integers.
    Label1.Size = New Size(100, 50)

    ' Set the location, constructing a point from a 32-bit integer
    ' (using hexadecimal).
    Label1.Location = New Point(&H280028)

    ' Set and align the text on the lower-right side of the label.
    Label1.TextAlign = ContentAlignment.BottomRight
    Label1.Text = "Bottom Right Alignment"
End Sub

설명

매개 변수의 dw 하위 16비트에서는 가로 x 좌표를 지정하고 16비트 이상에서는 새 Point에 대한 세로 y 좌표를 지정합니다.

적용 대상

Point(Int32, Int32)

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

public:
 Point(int x, int y);
public Point (int x, int y);
new System.Drawing.Point : int * int -> System.Drawing.Point
Public Sub New (x As Integer, y As Integer)

매개 변수

x
Int32

점의 가로 위치입니다.

y
Int32

점의 세로 위치입니다.

예제

다음 코드 예제에서는 연산자를 사용 Equality 하는 방법 및 또는 두 정수에서 를 PointSize 생성 하는 방법을 보여 줍니다. 또한 및 Y 속성을 사용하는 X 방법을 보여 줍니다. 이 예제는 Windows Forms 사용하도록 설계되었습니다. 라는 단추 Button1가 포함된 양식에 코드를 붙여넣고 메서드를 Button1_Click 단추의 Click 이벤트와 연결합니다.

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

적용 대상