語言

GraphicsPath.AddPolygon 方法

定義

會為這條路徑加上一個多邊形。

多載

名稱 Description
AddPolygon(ReadOnlySpan<Point>)

會為這條路徑加上一個多邊形。

AddPolygon(Point[])

會為這條路徑加上一個多邊形。

AddPolygon(PointF[])

會為這條路徑加上一個多邊形。

AddPolygon(ReadOnlySpan<PointF>)

會為這條路徑加上一個多邊形。

AddPolygon(ReadOnlySpan<Point>)

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs

會為這條路徑加上一個多邊形。

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

參數

points
ReadOnlySpan<Point>

一個定義要加多邊形的結構陣列 Point 。

適用於

AddPolygon(Point[])

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs

會為這條路徑加上一個多邊形。

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

參數

points
Point[]

一個定義要加多邊形的結構陣列 Point 。

範例

以下程式碼範例是為 Windows Forms 設計,並需要 PaintEventArgse,一個 OnPaint 事件物件。 此程式碼會執行下列動作:

  • 建立一個點陣列,定義一個多邊形。

  • 建立一條路徑,並將多邊形加入路徑。

  • 畫出通往螢幕的路徑。

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

備註

陣列中的 points 點指定多邊形的頂點。 如果陣列中的第一個點與最後一個點不同,則這兩個點會連接以封閉多邊形。

適用於

AddPolygon(PointF[])

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs

會為這條路徑加上一個多邊形。

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

參數

points
PointF[]

一個定義要加多邊形的結構陣列 PointF 。

範例

如需範例,請參閱 AddPolygon(Point[])。

備註

陣列中的 points 點指定多邊形的頂點。 如果陣列中的第一個點與最後一個點不同,則這兩個點會連接以封閉多邊形。

適用於

AddPolygon(ReadOnlySpan<PointF>)

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs

會為這條路徑加上一個多邊形。

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

參數

points
ReadOnlySpan<PointF>

一個定義要加多邊形的結構陣列 Point 。

適用於