Graphics.DrawLines 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
繪製一系列的線段,以連接 Point 結構的陣列。
多載
DrawLines(Pen, ReadOnlySpan<Point>) | |
DrawLines(Pen, ReadOnlySpan<PointF>) | |
DrawLines(Pen, Point[]) |
繪製一系列的線段,以連接 Point 結構的陣列。 |
DrawLines(Pen, PointF[]) |
繪製一系列的線段,以連接 PointF 結構的陣列。 |
DrawLines(Pen, ReadOnlySpan<Point>)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
public:
void DrawLines(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::Point> points);
public void DrawLines (System.Drawing.Pen pen, scoped ReadOnlySpan<System.Drawing.Point> points);
member this.DrawLines : System.Drawing.Pen * ReadOnlySpan<System.Drawing.Point> -> unit
Public Sub DrawLines (pen As Pen, points As ReadOnlySpan(Of Point))
參數
- pen
- Pen
- points
- ReadOnlySpan<Point>
適用於
DrawLines(Pen, ReadOnlySpan<PointF>)
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
public:
void DrawLines(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points);
public void DrawLines (System.Drawing.Pen pen, scoped ReadOnlySpan<System.Drawing.PointF> points);
member this.DrawLines : System.Drawing.Pen * ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub DrawLines (pen As Pen, points As ReadOnlySpan(Of PointF))
參數
- pen
- Pen
- points
- ReadOnlySpan<PointF>
適用於
DrawLines(Pen, Point[])
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
繪製一系列的線段,以連接 Point 結構的陣列。
public:
void DrawLines(System::Drawing::Pen ^ pen, cli::array <System::Drawing::Point> ^ points);
public:
void DrawLines(System::Drawing::Pen ^ pen, ... cli::array <System::Drawing::Point> ^ points);
public void DrawLines (System.Drawing.Pen pen, System.Drawing.Point[] points);
public void DrawLines (System.Drawing.Pen pen, params System.Drawing.Point[] points);
member this.DrawLines : System.Drawing.Pen * System.Drawing.Point[] -> unit
Public Sub DrawLines (pen As Pen, points As Point())
Public Sub DrawLines (pen As Pen, ParamArray points As Point())
參數
例外狀況
範例
下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse
,這是 Paint 事件處理程式的參數。 程式代碼會執行下列動作:
建立黑色畫筆。
建立線條區段點的陣列。
將連接的線條區段繪製到畫面。
public:
void DrawLinesPoint( PaintEventArgs^ e )
{
// Create pen.
Pen^ pen = gcnew Pen( Color::Black,3.0f );
// Create array of points that define lines to draw.
array<Point>^ points = {Point(10,10),Point(10,100),Point(200,50),Point(250,300)};
//Draw lines to screen.
e->Graphics->DrawLines( pen, points );
}
public void DrawLinesPoint(PaintEventArgs e)
{
// Create pen.
Pen pen = new Pen(Color.Black, 3);
// Create array of points that define lines to draw.
Point[] points =
{
new Point(10, 10),
new Point(10, 100),
new Point(200, 50),
new Point(250, 300)
};
//Draw lines to screen.
e.Graphics.DrawLines(pen, points);
}
Public Sub DrawLinesPoint(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create array of points that define lines to draw.
Dim points As Point() = {New Point(10, 10), New Point(10, 100), _
New Point(200, 50), New Point(250, 300)}
'Draw lines to screen.
e.Graphics.DrawLines(blackPen, points)
End Sub
備註
這個方法會繪製一系列連接結束點數位的線條。 陣列中的前兩個點會指定第一行。 每個額外的點都會指定線段的終點,其起點是上一行線段的終點。
適用於
DrawLines(Pen, PointF[])
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
- 來源:
- Graphics.cs
繪製一系列的線段,以連接 PointF 結構的陣列。
public:
void DrawLines(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points);
public:
void DrawLines(System::Drawing::Pen ^ pen, ... cli::array <System::Drawing::PointF> ^ points);
public void DrawLines (System.Drawing.Pen pen, System.Drawing.PointF[] points);
public void DrawLines (System.Drawing.Pen pen, params System.Drawing.PointF[] points);
member this.DrawLines : System.Drawing.Pen * System.Drawing.PointF[] -> unit
Public Sub DrawLines (pen As Pen, points As PointF())
Public Sub DrawLines (pen As Pen, ParamArray points As PointF())
參數
例外狀況
範例
下列程式代碼範例是專為搭配 Windows Forms 使用而設計,而且需要 PaintEventArgse
,這是 Paint 事件處理程式的參數。 程式代碼會執行下列動作:
程序代碼會建立黑色畫筆。
建立線條區段點的陣列。
將連接的線條區段繪製到畫面。
public:
void DrawLinesPointF( PaintEventArgs^ e )
{
// Create pen.
Pen^ pen = gcnew Pen( Color::Black,3.0f );
// Create array of points that define lines to draw.
array<PointF>^ points = {PointF(10.0F,10.0F),PointF(10.0F,100.0F),PointF(200.0F,50.0F),PointF(250.0F,300.0F)};
//Draw lines to screen.
e->Graphics->DrawLines( pen, points );
}
public void DrawLinesPointF(PaintEventArgs e)
{
// Create pen.
Pen pen = new Pen(Color.Black, 3);
// Create array of points that define lines to draw.
PointF[] points =
{
new PointF(10.0F, 10.0F),
new PointF(10.0F, 100.0F),
new PointF(200.0F, 50.0F),
new PointF(250.0F, 300.0F)
};
//Draw lines to screen.
e.Graphics.DrawLines(pen, points);
}
Public Sub DrawLinesPointF(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create array of points that define lines to draw.
Dim points As PointF() = {New PointF(10.0F, 10.0F), _
New PointF(10.0F, 100.0F), New PointF(200.0F, 50.0F), _
New PointF(250.0F, 300.0F)}
'Draw lines to screen.
e.Graphics.DrawLines(blackPen, points)
End Sub
備註
這個方法會繪製一系列連接結束點數位的線條。 陣列中的前兩個點會指定第一行。 每個額外的點都會指定線段的終點,其起點是上一行線段的終點。