Point Konstruktoren

Definition

Initialisiert eine neue Instanz der Point Struktur mit den angegebenen Koordinaten.

Überlädt

Name Beschreibung
Point(Size)

Initialisiert eine neue Instanz der Point Struktur aus einer Size.

Point(Int32)

Initialisiert eine neue Instanz der Struktur mithilfe von Koordinaten, die Point durch einen ganzzahligen Wert angegeben werden.

Point(Int32, Int32)

Initialisiert eine neue Instanz der Point Struktur mit den angegebenen Koordinaten.

Point(Size)

Quelle:
Point.cs
Quelle:
Point.cs
Quelle:
Point.cs
Quelle:
Point.cs
Quelle:
Point.cs

Initialisiert eine neue Instanz der Point Struktur aus einer Size.

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)

Parameter

sz
Size

A Size that specifies the coordinates for the new Point.

Beispiele

Im folgenden Codebeispiel wird die Verwendung des Equality Operators und das Erstellen einer Point aus einer Size oder zwei ganzzahligen Zahlen veranschaulicht. Außerdem wird veranschaulicht, wie die X Eigenschaften verwendet werden Y . Dieses Beispiel wurde für die Verwendung mit Windows Forms entwickelt. Fügen Sie den Code in ein Formular ein, das eine Schaltfläche mit dem Namen Button1enthält, und ordnen Sie die Button1_Click Methode dem Ereignis der Schaltfläche Click zu.

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

Gilt für:

Point(Int32)

Quelle:
Point.cs
Quelle:
Point.cs
Quelle:
Point.cs
Quelle:
Point.cs
Quelle:
Point.cs

Initialisiert eine neue Instanz der Struktur mithilfe von Koordinaten, die Point durch einen ganzzahligen Wert angegeben werden.

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

Parameter

dw
Int32

Eine 32-Bit-Ganzzahl, die die Koordinaten für das neue Pointangibt.

Beispiele

Im folgenden Codebeispiel wird die Verwendung der Point Konstruktoren und Size.Size der System.Drawing.ContentAlignment Enumeration veranschaulicht. Zum Ausführen dieses Beispiels fügen Sie diesen Code in ein Windows Formular ein, das eine Bezeichnung mit dem Namen Label1 enthält, und rufen Sie die InitializeLabel1-Methode im Konstruktor des Formulars auf.

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

Hinweise

Die 16 Bit der niedrigen Reihenfolge des dw Parameters geben die horizontale x-Koordinate und die höheren 16 Bits die vertikale y-Koordinate für das neue Pointan.

Gilt für:

Point(Int32, Int32)

Quelle:
Point.cs
Quelle:
Point.cs
Quelle:
Point.cs
Quelle:
Point.cs
Quelle:
Point.cs

Initialisiert eine neue Instanz der Point Struktur mit den angegebenen Koordinaten.

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)

Parameter

x
Int32

Die horizontale Position des Punkts.

y
Int32

Die vertikale Position des Punkts.

Beispiele

Im folgenden Codebeispiel wird die Verwendung des Equality Operators und das Erstellen einer Point aus einer Size oder zwei ganzzahligen Zahlen veranschaulicht. Außerdem wird veranschaulicht, wie die X Eigenschaften verwendet werden Y . Dieses Beispiel wurde für die Verwendung mit Windows Forms entwickelt. Fügen Sie den Code in ein Formular ein, das eine Schaltfläche mit dem Namen Button1enthält, und ordnen Sie die Button1_Click Methode dem Ereignis der Schaltfläche Click zu.

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

Gilt für: