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
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 窗体一起使用,它需要 PaintEventArgseOnPaint 事件对象。 该代码执行以下操作:

  • 创建描述三角形的四个点的数组。

  • 创建路径并添加行数组。

  • 绘制屏幕的路径。

请注意,第一个点后面的每一行都使用上一个点作为起点,新点作为终结点。

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
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
Source:
GraphicsPath.cs
public:
 void AddLines(ReadOnlySpan<System::Drawing::Point> points);
public void AddLines (scoped 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
Source:
GraphicsPath.cs
public:
 void AddLines(ReadOnlySpan<System::Drawing::PointF> points);
public void AddLines (scoped ReadOnlySpan<System.Drawing.PointF> points);
member this.AddLines : ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub AddLines (points As ReadOnlySpan(Of PointF))

参数

适用于