GraphicsPath.AddPolygon メソッド

定義

パスに多角形を追加します。Adds a polygon to this path.

オーバーロード

AddPolygon(Point[])

パスに多角形を追加します。Adds a polygon to this path.

AddPolygon(PointF[])

パスに多角形を追加します。Adds a polygon to this path.

AddPolygon(Point[])

パスに多角形を追加します。Adds a polygon to this path.

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 構造体の配列。An array of Point structures that defines the polygon to add.

次のコード例は、Windows フォームで使用するように設計されており、イベントオブジェクトを必要とし PaintEventArgs e OnPaint ます。The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, an OnPaint event object. コードは、次のアクションを実行します。The code performs the following actions:

  • 多角形を定義する点の配列を作成します。Creates an array of points that defines a polygon.

  • パスを作成し、そのパスに多角形を追加します。Creates a path and adds the polygon to the path.

  • 画面へのパスを描画します。Draws the path to the screen.

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 多角形の頂点を指定します。The points in the points array specify the vertices of a polygon. 配列内の最初の点が最後の点と異なる場合、これらの2つの点は多角形を閉じるために接続されます。If the first point in the array is not the same as the last point, those two points are connected to close the polygon.

適用対象

AddPolygon(PointF[])

パスに多角形を追加します。Adds a polygon to this path.

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 構造体の配列。An array of PointF structures that defines the polygon to add.

例については、「AddPolygon(Point[])」を参照してください。For an example, see AddPolygon(Point[]).

注釈

配列内の点は、 points 多角形の頂点を指定します。The points in the points array specify the vertices of a polygon. 配列内の最初の点が最後の点と異なる場合、これらの2つの点は多角形を閉じるために接続されます。If the first point in the array is not the same as the last point, those two points are connected to close the polygon.

適用対象