Freigeben über


GraphicsPath.AddPolygon Methode

Definition

Fügt diesem Pfad ein Polygon hinzu.

Überlädt

AddPolygon(ReadOnlySpan<Point>)
AddPolygon(Point[])

Fügt diesem Pfad ein Polygon hinzu.

AddPolygon(PointF[])

Fügt diesem Pfad ein Polygon hinzu.

AddPolygon(ReadOnlySpan<PointF>)

AddPolygon(ReadOnlySpan<Point>)

Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs
public:
 void AddPolygon(ReadOnlySpan<System::Drawing::Point> points);
public void AddPolygon (ReadOnlySpan<System.Drawing.Point> points);
member this.AddPolygon : ReadOnlySpan<System.Drawing.Point> -> unit
Public Sub AddPolygon (points As ReadOnlySpan(Of Point))

Parameter

Gilt für:

AddPolygon(Point[])

Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs

Fügt diesem Pfad ein Polygon hinzu.

public:
 void AddPolygon(cli::array <System::Drawing::Point> ^ points);
public void AddPolygon (System.Drawing.Point[] points);
member this.AddPolygon : System.Drawing.Point[] -> unit
Public Sub AddPolygon (points As Point())

Parameter

points
Point[]

Ein Array von Point Strukturen, die das hinzuzufügende Polygon definieren.

Beispiele

Das folgende Codebeispiel wurde für die Verwendung mit Windows Forms entwickelt und erfordert PaintEventArgse, ein OnPaint-Ereignisobjekt. Der Code führt die folgenden Aktionen aus:

  • Erstellt ein Array von Punkten, das ein Polygon definiert.

  • Erstellt einen Pfad und fügt das Polygon dem Pfad hinzu.

  • Zeichnet den Pfad zum Bildschirm.

private:
   void AddPolygonExample( PaintEventArgs^ e )
   {
      // Create an array of points.
      array<Point>^ myArray = {Point(23,20),Point(40,10),Point(57,20),Point(50,40),Point(30,40)};

      // Create a GraphicsPath object and add a polygon.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      myPath->AddPolygon( myArray );

      // Draw the path to the screen.
      Pen^ myPen = gcnew Pen( Color::Black,2.0f );
      e->Graphics->DrawPath( myPen, myPath );
   }
private void AddPolygonExample(PaintEventArgs e)
{
             
    // Create an array of points.
    Point[] myArray =
             {
                 new Point(23, 20),
                 new Point(40, 10),
                 new Point(57, 20),
                 new Point(50, 40),
                 new Point(30, 40)
             };
             
    // Create a GraphicsPath object and add a polygon.
    GraphicsPath myPath = new GraphicsPath();
    myPath.AddPolygon(myArray);
             
    // Draw the path to the screen.
    Pen myPen = new Pen(Color.Black, 2);
    e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddPolygonExample(ByVal e As PaintEventArgs)

    ' Create an array of points.
    Dim myArray As Point() = {New Point(23, 20), New Point(40, 10), _
    New Point(57, 20), New Point(50, 40), New Point(30, 40)}

    ' Create a GraphicsPath object and add a polygon.
    Dim myPath As New GraphicsPath
    myPath.AddPolygon(myArray)

    ' Draw the path to the screen.
    Dim myPen As New Pen(Color.Black, 2)
    e.Graphics.DrawPath(myPen, myPath)
End Sub

Hinweise

Die Punkte im points Array geben die Scheitelpunkte eines Polygons an. Wenn der erste Punkt im Array nicht mit dem letzten Punkt übereinstimmt, werden diese beiden Punkte verbunden, um das Polygon zu schließen.

Gilt für:

AddPolygon(PointF[])

Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs

Fügt diesem Pfad ein Polygon hinzu.

public:
 void AddPolygon(cli::array <System::Drawing::PointF> ^ points);
public void AddPolygon (System.Drawing.PointF[] points);
member this.AddPolygon : System.Drawing.PointF[] -> unit
Public Sub AddPolygon (points As PointF())

Parameter

points
PointF[]

Ein Array von PointF Strukturen, die das hinzuzufügende Polygon definieren.

Beispiele

Ein Beispiel finden Sie unter AddPolygon(Point[]).

Hinweise

Die Punkte im points Array geben die Scheitelpunkte eines Polygons an. Wenn der erste Punkt im Array nicht mit dem letzten Punkt übereinstimmt, werden diese beiden Punkte verbunden, um das Polygon zu schließen.

Gilt für:

AddPolygon(ReadOnlySpan<PointF>)

Quelle:
GraphicsPath.cs
Quelle:
GraphicsPath.cs
public:
 void AddPolygon(ReadOnlySpan<System::Drawing::PointF> points);
public void AddPolygon (ReadOnlySpan<System.Drawing.PointF> points);
member this.AddPolygon : ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub AddPolygon (points As ReadOnlySpan(Of PointF))

Parameter

Gilt für: