GraphicsPath.AddPolygon 메서드

정의

이 경로에 다각형을 추가합니다.

오버로드

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

이 경로에 다각형을 추가합니다.

AddPolygon(PointF[])

이 경로에 다각형을 추가합니다.

AddPolygon(ReadOnlySpan<PointF>)

AddPolygon(ReadOnlySpan<Point>)

Source:
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[])

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
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 Forms 사용하도록 설계되었으며 이벤트 개체인 이 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 점은 다각형의 꼭짓점을 지정합니다. 배열의 첫 번째 점이 마지막 점과 같지 않으면 해당 두 점이 연결되어 다각형을 닫습니다.

적용 대상

AddPolygon(PointF[])

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
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 점은 다각형의 꼭짓점을 지정합니다. 배열의 첫 번째 점이 마지막 점과 같지 않으면 해당 두 점이 연결되어 다각형을 닫습니다.

적용 대상

AddPolygon(ReadOnlySpan<PointF>)

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

매개 변수

적용 대상