GraphicsPath.AddLines 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將一系列的連接線段附加至這個 GraphicsPath的結尾。
多載
AddLines(Point[]) |
將一系列的連接線段附加至這個 GraphicsPath的結尾。 |
AddLines(PointF[]) |
將一系列的連接線段附加至這個 GraphicsPath的結尾。 |
AddLines(ReadOnlySpan<Point>) | |
AddLines(ReadOnlySpan<PointF>) |
AddLines(Point[])
將一系列的連接線段附加至這個 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())
參數
範例
下列程式代碼範例的設計目的是要與 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的結尾。
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())
參數
範例
如需範例,請參閱 AddLines(Point[])。
備註
如果圖中有上一條線條或曲線,則會新增一條線來連接上一個線段的起點。
points
參數會指定端點陣列。 前兩個指定第一行。 每個額外的點都會指定線段的端點,其起點是上一行的端點。
適用於
AddLines(ReadOnlySpan<Point>)
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))
參數
- points
- ReadOnlySpan<Point>
適用於
AddLines(ReadOnlySpan<PointF>)
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))
參數
- points
- ReadOnlySpan<PointF>