GraphicsPath.AddLines 方法

定义

向此 GraphicsPath 末尾追加一系列相互连接的线段。

重载

AddLines(Point[])

向此 GraphicsPath 末尾追加一系列相互连接的线段。

AddLines(PointF[])

向此 GraphicsPath 末尾追加一系列相互连接的线段。

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

AddLines(Point[])

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
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 窗体,它需要 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[])

Source:
GraphicsPath.cs
Source:
GraphicsPath.cs
Source:
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>)

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

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

参数

适用于