GraphicsPath.AddBeziers 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將連接的三次方貝茲曲線序列加入至目前的圖形。
多載
AddBeziers(ReadOnlySpan<PointF>) | |
AddBeziers(ReadOnlySpan<Point>) | |
AddBeziers(Point[]) |
將連接的三次方貝茲曲線序列加入至目前的圖形。 |
AddBeziers(PointF[]) |
將連接的三次方貝茲曲線序列加入至目前的圖形。 |
AddBeziers(ReadOnlySpan<PointF>)
public:
void AddBeziers(ReadOnlySpan<System::Drawing::PointF> points);
public void AddBeziers (ReadOnlySpan<System.Drawing.PointF> points);
member this.AddBeziers : ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub AddBeziers (points As ReadOnlySpan(Of PointF))
參數
- points
- ReadOnlySpan<PointF>
適用於
AddBeziers(ReadOnlySpan<Point>)
public:
void AddBeziers(ReadOnlySpan<System::Drawing::Point> points);
public void AddBeziers (ReadOnlySpan<System.Drawing.Point> points);
member this.AddBeziers : ReadOnlySpan<System.Drawing.Point> -> unit
Public Sub AddBeziers (points As ReadOnlySpan(Of Point))
參數
- points
- ReadOnlySpan<Point>
適用於
AddBeziers(Point[])
將連接的三次方貝茲曲線序列加入至目前的圖形。
public:
void AddBeziers(... cli::array <System::Drawing::Point> ^ points);
public:
void AddBeziers(cli::array <System::Drawing::Point> ^ points);
public void AddBeziers (params System.Drawing.Point[] points);
public void AddBeziers (System.Drawing.Point[] points);
member this.AddBeziers : System.Drawing.Point[] -> unit
Public Sub AddBeziers (ParamArray points As Point())
Public Sub AddBeziers (points As Point())
參數
範例
下列程式代碼範例是設計來搭配 Windows Forms 使用,而且需要 PaintEventArgse
事件OnPaint物件。 此程式碼會執行下列動作:
建立七個點的陣列, (代表兩個連接的 Bézier 曲線) 。
建立路徑,並將 Bézier 曲線數列新增至路徑。
繪製畫面的路徑。
private:
void AddBeziersExample( PaintEventArgs^ e )
{
// Adds two Bezier curves.
array<Point>^ myArray = {Point(20,100),Point(40,75),Point(60,125),Point(80,100),Point(100,50),Point(120,150),Point(140,100)};
// Create the path and add the curves.
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->AddBeziers( myArray );
// Draw the path to the screen.
Pen^ myPen = gcnew Pen( Color::Black,2.0f );
e->Graphics->DrawPath( myPen, myPath );
}
private void AddBeziersExample(PaintEventArgs e)
{
// Adds two Bezier curves.
Point[] myArray =
{
new Point(20, 100),
new Point(40, 75),
new Point(60, 125),
new Point(80, 100),
new Point(100, 50),
new Point(120, 150),
new Point(140, 100)
};
// Create the path and add the curves.
GraphicsPath myPath = new GraphicsPath();
myPath.AddBeziers(myArray);
// Draw the path to the screen.
Pen myPen = new Pen(Color.Black, 2);
e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddBeziersExample(ByVal e As PaintEventArgs)
' Adds two Bezier curves.
Dim myArray As Point() = {New Point(20, 100), New Point(40, 75), _
New Point(60, 125), New Point(80, 100), New Point(100, 50), _
New Point(120, 150), New Point(140, 100)}
Dim myPath As New GraphicsPath
myPath.AddBeziers(myArray)
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
End Sub
備註
參數 points
會指定連接曲線的端點和控制點陣列。 第一個曲線是使用第二和第三個點做為控制點,從陣列的第 points
一個點建構到第四個點。 除了前一個曲線的端點之外,序列中的每個後續曲線只需要三個以上的點:序列中的下兩個點是控制點,第三個是新增曲線的端點。
如果圖中有前一條線或曲線,則會新增線條,將上一個線段的端點連接到序列中第一個三次方曲線的起點。
適用於
AddBeziers(PointF[])
將連接的三次方貝茲曲線序列加入至目前的圖形。
public:
void AddBeziers(cli::array <System::Drawing::PointF> ^ points);
public:
void AddBeziers(... cli::array <System::Drawing::PointF> ^ points);
public void AddBeziers (System.Drawing.PointF[] points);
public void AddBeziers (params System.Drawing.PointF[] points);
member this.AddBeziers : System.Drawing.PointF[] -> unit
Public Sub AddBeziers (points As PointF())
Public Sub AddBeziers (ParamArray points As PointF())
參數
範例
如需範例,請參閱:
備註
參數 points
會指定連接曲線的端點和控制點陣列。 第一個曲線是使用第二和第三個點做為控制點,從陣列的第 points
一個點建構到第四個點。 除了前一個曲線的端點之外,序列中的每個後續曲線只需要三個以上的點:序列中的下兩個點是控制點,第三個是新增曲線的端點。
如果圖中有前一條線或曲線,則會新增線條,將上一個線段的端點連接到序列中第一個三次方曲線的起點。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應