GraphicsPath.AddCurve 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將曲線加入目前的圖形。 主要曲線會被使用,因為該曲線會經過陣列中的每一個點。
多載
AddCurve(ReadOnlySpan<Point>, Single) | |
AddCurve(PointF[], Int32, Int32, Single) |
將曲線加入目前的圖形。 |
AddCurve(Point[], Int32, Int32, Single) |
將曲線加入目前的圖形。 |
AddCurve(ReadOnlySpan<PointF>, Single) | |
AddCurve(PointF[], Single) |
將曲線加入目前的圖形。 |
AddCurve(Point[]) |
將曲線加入目前的圖形。 主要曲線會被使用,因為該曲線會經過陣列中的每一個點。 |
AddCurve(ReadOnlySpan<PointF>) | |
AddCurve(ReadOnlySpan<Point>) | |
AddCurve(PointF[]) |
將曲線加入目前的圖形。 主要曲線會被使用,因為該曲線會經過陣列中的每一個點。 |
AddCurve(Point[], Single) |
將曲線加入目前的圖形。 |
AddCurve(ReadOnlySpan<Point>, Single)
public:
void AddCurve(ReadOnlySpan<System::Drawing::Point> points, float tension);
public void AddCurve (ReadOnlySpan<System.Drawing.Point> points, float tension);
member this.AddCurve : ReadOnlySpan<System.Drawing.Point> * single -> unit
Public Sub AddCurve (points As ReadOnlySpan(Of Point), tension As Single)
參數
- points
- ReadOnlySpan<Point>
- tension
- Single
適用於
AddCurve(PointF[], Int32, Int32, Single)
將曲線加入目前的圖形。
public:
void AddCurve(cli::array <System::Drawing::PointF> ^ points, int offset, int numberOfSegments, float tension);
public void AddCurve (System.Drawing.PointF[] points, int offset, int numberOfSegments, float tension);
member this.AddCurve : System.Drawing.PointF[] * int * int * single -> unit
Public Sub AddCurve (points As PointF(), offset As Integer, numberOfSegments As Integer, tension As Single)
參數
- offset
- Int32
points
陣列中元素的索引,做為曲線中的第一個點。
- numberOfSegments
- Int32
用來繪製曲線的線段數。 線段可以視為連接兩點的直線。
- tension
- Single
值,指定曲線在控制點之間彎曲的數量。 大於 1 的值會產生無法預期的結果。
範例
如需範例,請參閱 AddCurve(Point[], Int32, Int32, Single)。
備註
如果需要,用戶必須保留原始點。 原始點會轉換成內部的三次方貝塞爾控制點,因此沒有傳回原始點的機制。
曲線會從 所 offset
指定的陣列中點開始,並包含 所指定 numberOfSegments
之 (區段) 的點數。
適用於
AddCurve(Point[], Int32, Int32, Single)
將曲線加入目前的圖形。
public:
void AddCurve(cli::array <System::Drawing::Point> ^ points, int offset, int numberOfSegments, float tension);
public void AddCurve (System.Drawing.Point[] points, int offset, int numberOfSegments, float tension);
member this.AddCurve : System.Drawing.Point[] * int * int * single -> unit
Public Sub AddCurve (points As Point(), offset As Integer, numberOfSegments As Integer, tension As Single)
參數
- offset
- Int32
points
陣列中元素的索引,做為曲線中的第一個點。
- numberOfSegments
- Int32
值,指定曲線在控制點之間彎曲的數量。 大於 1 的值會產生無法預期的結果。
- tension
- Single
值,指定曲線在控制點之間彎曲的數量。 大於 1 的值會產生無法預期的結果。
範例
下列程式代碼範例是設計來搭配 Windows Forms 使用,而且需要 PaintEventArgse
事件OnPaint物件。 此程式碼會執行下列動作:
建立四個點的陣列, (代表基數曲線) 。
建立路徑並使用點陣列,將曲線新增至路徑。
繪製畫面的路徑。
請注意,當陣列保留四個點時,只有三個區段,這是呼叫 AddCurve的第三個自變數中指定的數位。
private:
void AddCurveExample( PaintEventArgs^ e )
{
// Create some points.
Point point1 = Point(20,20);
Point point2 = Point(40,0);
Point point3 = Point(60,40);
Point point4 = Point(80,20);
// Create an array of the points.
array<Point>^ curvePoints = {point1,point2,point3,point4};
// Create a GraphicsPath object and add a curve.
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->AddCurve( curvePoints, 0, 3, 0.8f );
// Draw the path to the screen.
Pen^ myPen = gcnew Pen( Color::Black,2.0f );
e->Graphics->DrawPath( myPen, myPath );
}
private void AddCurveExample(PaintEventArgs e)
{
// Create some points.
Point point1 = new Point(20, 20);
Point point2 = new Point(40, 0);
Point point3 = new Point(60, 40);
Point point4 = new Point(80, 20);
// Create an array of the points.
Point[] curvePoints = {point1, point2, point3, point4};
// Create a GraphicsPath object and add a curve.
GraphicsPath myPath = new GraphicsPath();
myPath.AddCurve(curvePoints, 0, 3, 0.8f);
// Draw the path to the screen.
Pen myPen = new Pen(Color.Black, 2);
e.Graphics.DrawPath(myPen, myPath);
}
Public Sub AddCurveExample(ByVal e As PaintEventArgs)
' Create some points.
Dim point1 As New Point(20, 20)
Dim point2 As New Point(40, 0)
Dim point3 As New Point(60, 40)
Dim point4 As New Point(80, 20)
' Create an array of the points.
Dim curvePoints As Point() = {point1, point2, point3, point4}
' Create a GraphicsPath object and add a curve.
Dim myPath As New GraphicsPath
myPath.AddCurve(curvePoints, 0, 3, 0.8F)
' Draw the path to the screen.
Dim myPen As New Pen(Color.Black, 2)
e.Graphics.DrawPath(myPen, myPath)
End Sub
備註
如果需要,用戶必須保留原始點。 原始點會轉換成內部的三次方貝塞爾控制點,因此沒有傳回原始點的機制。
曲線從 參數所 offset
指定的陣列中點開始,並包含 所指定 numberOfSegments
(區段的點數) 。
適用於
AddCurve(ReadOnlySpan<PointF>, Single)
public:
void AddCurve(ReadOnlySpan<System::Drawing::PointF> points, float tension);
public void AddCurve (ReadOnlySpan<System.Drawing.PointF> points, float tension);
member this.AddCurve : ReadOnlySpan<System.Drawing.PointF> * single -> unit
Public Sub AddCurve (points As ReadOnlySpan(Of PointF), tension As Single)
參數
- points
- ReadOnlySpan<PointF>
- tension
- Single
適用於
AddCurve(PointF[], Single)
將曲線加入目前的圖形。
public:
void AddCurve(cli::array <System::Drawing::PointF> ^ points, float tension);
public void AddCurve (System.Drawing.PointF[] points, float tension);
member this.AddCurve : System.Drawing.PointF[] * single -> unit
Public Sub AddCurve (points As PointF(), tension As Single)
參數
- tension
- Single
值,指定曲線在控制點之間彎曲的數量。 大於 1 的值會產生無法預期的結果。
範例
如需範例,請參閱 AddCurve(Point[], Int32, Int32, Single)。
備註
如果需要,用戶必須保留原始點。 原始點會轉換成內部的三次方貝塞爾控制點,因此沒有傳回原始點的機制。
適用於
AddCurve(Point[])
將曲線加入目前的圖形。 主要曲線會被使用,因為該曲線會經過陣列中的每一個點。
public:
void AddCurve(cli::array <System::Drawing::Point> ^ points);
public:
void AddCurve(... cli::array <System::Drawing::Point> ^ points);
public void AddCurve (System.Drawing.Point[] points);
public void AddCurve (params System.Drawing.Point[] points);
member this.AddCurve : System.Drawing.Point[] -> unit
Public Sub AddCurve (points As Point())
Public Sub AddCurve (ParamArray points As Point())
參數
範例
如需範例,請參閱 AddClosedCurve(Point[], Single)。
備註
如果需要,用戶必須保留原始點。 原始點會轉換成內部的三次方貝塞爾控制點,因此沒有傳回原始點的機制。
適用於
AddCurve(ReadOnlySpan<PointF>)
public:
void AddCurve(ReadOnlySpan<System::Drawing::PointF> points);
public void AddCurve (ReadOnlySpan<System.Drawing.PointF> points);
member this.AddCurve : ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub AddCurve (points As ReadOnlySpan(Of PointF))
參數
- points
- ReadOnlySpan<PointF>
適用於
AddCurve(ReadOnlySpan<Point>)
public:
void AddCurve(ReadOnlySpan<System::Drawing::Point> points);
public void AddCurve (ReadOnlySpan<System.Drawing.Point> points);
member this.AddCurve : ReadOnlySpan<System.Drawing.Point> -> unit
Public Sub AddCurve (points As ReadOnlySpan(Of Point))
參數
- points
- ReadOnlySpan<Point>
適用於
AddCurve(PointF[])
將曲線加入目前的圖形。 主要曲線會被使用,因為該曲線會經過陣列中的每一個點。
public:
void AddCurve(cli::array <System::Drawing::PointF> ^ points);
public:
void AddCurve(... cli::array <System::Drawing::PointF> ^ points);
public void AddCurve (System.Drawing.PointF[] points);
public void AddCurve (params System.Drawing.PointF[] points);
member this.AddCurve : System.Drawing.PointF[] -> unit
Public Sub AddCurve (points As PointF())
Public Sub AddCurve (ParamArray points As PointF())
參數
範例
如需範例,請參閱 AddCurve(Point[], Int32, Int32, Single)。
備註
如果需要,用戶必須保留原始點。 原始點會轉換成內部的三次方貝塞爾控制點,因此沒有傳回原始點的機制。
適用於
AddCurve(Point[], Single)
將曲線加入目前的圖形。
public:
void AddCurve(cli::array <System::Drawing::Point> ^ points, float tension);
public void AddCurve (System.Drawing.Point[] points, float tension);
member this.AddCurve : System.Drawing.Point[] * single -> unit
Public Sub AddCurve (points As Point(), tension As Single)
參數
- tension
- Single
值,指定曲線在控制點之間彎曲的數量。 大於 1 的值會產生無法預期的結果。
範例
如需範例,請參閱 AddClosedCurve(Point[], Single)。
備註
如果需要,用戶必須保留原始點。 原始點會轉換成內部的三次方貝塞爾控制點,因此沒有傳回原始點的機制。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應