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
public:
void DrawLines(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::Point> points);
public void DrawLines (System.Drawing.Pen pen, 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
public:
void DrawLines(System::Drawing::Pen ^ pen, ReadOnlySpan<System::Drawing::PointF> points);
public void DrawLines (System.Drawing.Pen pen, 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
繪製連接 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
繪製連接 PointF 結構陣列的一系列直線線段。
public:
void DrawLines(System::Drawing::Pen ^ pen, cli::array <System::Drawing::PointF> ^ points);
public void DrawLines (System.Drawing.Pen pen, System.Drawing.PointF[] points);
member this.DrawLines : System.Drawing.Pen * System.Drawing.PointF[] -> unit
Public Sub DrawLines (pen As Pen, 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
備註
這個方法會繪製一系列連接結束點數位的線條。 陣列中的前兩個點會指定第一行。 每個額外點都會指定線段的終點,其起點是前一條線段的結束點。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應