GraphicsPath.AddLines 方法

定義

將一系列連接的線段附加至這個 GraphicsPath 的結尾。

多載

AddLines(Point[])

將一系列連接的線段附加至這個 GraphicsPath 的結尾。

AddLines(PointF[])

將一系列連接的線段附加至這個 GraphicsPath 的結尾。

AddLines(ReadOnlySpan<Point>)
AddLines(ReadOnlySpan<PointF>)

AddLines(Point[])

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

將一系列連接的線段附加至這個 GraphicsPath 的結尾。

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

參數

points
Point[]

Point 結構的陣列,表示定義要加入的直線線段的點。

範例

下列程式代碼範例是設計來搭配 Windows Forms 使用,而且需要 PaintEventArgse事件OnPaint物件。 此程式碼會執行下列動作:

  • 建立描述三角形之四點的陣列。

  • 建立路徑並加入行陣列。

  • 繪製畫面的路徑。

請注意,第一個點後面的每一行都會使用前一個點做為起點,而新點則作為端點。

private:
   void AddLinesExample( PaintEventArgs^ e )
   {
      // Create a symetrical triangle using an array of points.
      array<Point>^ myArray = {Point(30,30),Point(60,60),Point(0,60),Point(30,30)};

      //Create a path and add lines.
      GraphicsPath^ myPath = gcnew GraphicsPath;
      myPath->AddLines( myArray );

      // Draw the path to the screen.
      Pen^ myPen = gcnew Pen( Color::Black,2.0f );
      e->Graphics->DrawPath( myPen, myPath );
   }
private void AddLinesExample(PaintEventArgs e)
{
             
    // Create a symmetrical triangle using an array of points.
    Point[] myArray =
             {
                 new Point(30,30),
                 new Point(60,60),
                 new Point(0,60),
                 new Point(30,30)
             };
             
    //Create a path and add lines.
    GraphicsPath myPath = new GraphicsPath();
    myPath.AddLines(myArray);
             
    // Draw the path to the screen.
    Pen myPen = new Pen(Color.Black, 2);
    e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddLinesExample(ByVal e As PaintEventArgs)

    'Create a symmetrical triangle using an array of points.
    Dim myArray As Point() = {New Point(30, 30), New Point(60, 60), _
    New Point(0, 60), New Point(30, 30)}
    Dim myPath As New GraphicsPath
    myPath.AddLines(myArray)

    ' Draw the path to the screen.
    Dim myPen As New Pen(Color.Black, 2)
    e.Graphics.DrawPath(myPen, myPath)
End Sub

備註

如果圖中有上一條線或曲線,則會新增線條來連接上一個線段的起點。 參數 points 會指定端點陣列。 前兩個指定第一行。 每個額外點都會指定線段的端點,其起點是上一行的端點。

適用於

AddLines(PointF[])

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

將一系列連接的線段附加至這個 GraphicsPath 的結尾。

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

參數

points
PointF[]

PointF 結構的陣列,表示定義要加入的直線線段的點。

範例

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

備註

如果圖中有上一條線或曲線,則會新增線條來連接上一個線段的起點。 參數 points 會指定端點陣列。 前兩個指定第一行。 每個額外點都會指定線段的端點,其起點是上一行的端點。

適用於

AddLines(ReadOnlySpan<Point>)

來源:
GraphicsPath.cs
public:
 void AddLines(ReadOnlySpan<System::Drawing::Point> points);
public void AddLines (ReadOnlySpan<System.Drawing.Point> points);
member this.AddLines : ReadOnlySpan<System.Drawing.Point> -> unit
Public Sub AddLines (points As ReadOnlySpan(Of Point))

參數

適用於

AddLines(ReadOnlySpan<PointF>)

來源:
GraphicsPath.cs
public:
 void AddLines(ReadOnlySpan<System::Drawing::PointF> points);
public void AddLines (ReadOnlySpan<System.Drawing.PointF> points);
member this.AddLines : ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub AddLines (points As ReadOnlySpan(Of PointF))

參數

適用於