GraphicsPath.AddPolygon Metoda

Definice

Přidá mnohoúhelník do této cesty.

Přetížení

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

Přidá mnohoúhelník do této cesty.

AddPolygon(PointF[])

Přidá mnohoúhelník do této cesty.

AddPolygon(ReadOnlySpan<PointF>)

AddPolygon(ReadOnlySpan<Point>)

Zdroj:
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))

Parametry

Platí pro

AddPolygon(Point[])

Zdroj:
GraphicsPath.cs
Zdroj:
GraphicsPath.cs
Zdroj:
GraphicsPath.cs

Přidá mnohoúhelník do této cesty.

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())

Parametry

points
Point[]

Pole Point struktur definující mnohoúhelník, který se má přidat.

Příklady

Následující příklad kódu je navržený pro použití s model Windows Forms a vyžaduje PaintEventArgseobjekt OnPaint události . Kód provede následující akce:

  • Vytvoří pole bodů, které definují mnohoúhelník.

  • Vytvoří cestu a přidá mnohoúhelník do cesty.

  • Nakreslí cestu k obrazovce.

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

Poznámky

Body v points poli určují vrcholy mnohoúhelníku. Pokud první bod v matici není stejný jako poslední bod, jsou tyto dva body spojeny za účelem uzavření mnohoúhelníku.

Platí pro

AddPolygon(PointF[])

Zdroj:
GraphicsPath.cs
Zdroj:
GraphicsPath.cs
Zdroj:
GraphicsPath.cs

Přidá mnohoúhelník do této cesty.

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())

Parametry

points
PointF[]

Pole PointF struktur definující mnohoúhelník, který se má přidat.

Příklady

Příklad naleznete v tématu AddPolygon(Point[]).

Poznámky

Body v points poli určují vrcholy mnohoúhelníku. Pokud první bod v matici není stejný jako poslední bod, jsou tyto dva body spojeny za účelem uzavření mnohoúhelníku.

Platí pro

AddPolygon(ReadOnlySpan<PointF>)

Zdroj:
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))

Parametry

Platí pro