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 (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 (ReadOnlySpan<System.Drawing.PointF> points);
member this.AddLines : ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub AddLines (points As ReadOnlySpan(Of PointF))
參數
- points
- ReadOnlySpan<PointF>
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應