GraphicsPath.AddPolygon メソッド

定義

パスに多角形を追加します。

オーバーロード

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

パスに多角形を追加します。

AddPolygon(PointF[])

パスに多角形を追加します。

AddPolygon(ReadOnlySpan<PointF>)

AddPolygon(ReadOnlySpan<Point>)

ソース:
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))

パラメーター

適用対象

AddPolygon(Point[])

ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs

パスに多角形を追加します。

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

パラメーター

points
Point[]

追加する多角形を定義する Point 構造体の配列。

次のコード例は、Windows フォームで使用するように設計されており、イベント オブジェクトがOnPaint必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • 多角形を定義するポイントの配列を作成します。

  • パスを作成し、多角形をパスに追加します。

  • 画面へのパスを描画します。

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 ポイントは、多角形の頂点を指定します。 配列内の最初のポイントが最後のポイントと同じでない場合、これらの 2 つのポイントは多角形を閉じるように接続されます。

適用対象

AddPolygon(PointF[])

ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs
ソース:
GraphicsPath.cs

パスに多角形を追加します。

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

パラメーター

points
PointF[]

追加する多角形を定義する PointF 構造体の配列。

例については、「AddPolygon(Point[])」を参照してください。

注釈

配列内の points ポイントは、多角形の頂点を指定します。 配列内の最初のポイントが最後のポイントと同じでない場合、これらの 2 つのポイントは多角形を閉じるように接続されます。

適用対象

AddPolygon(ReadOnlySpan<PointF>)

ソース:
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))

パラメーター

適用対象