GraphicsPath.AddCurve 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
為目前圖形加入樣條曲線。 使用基數樣條曲線是因為曲線會通過陣列中的每個點。
多載
| 名稱 | Description |
|---|---|
| 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>
一個結構陣列 PointF ,代表定義曲線的點。
- tension
- Single
一個指定曲線在控制點間彎曲幅度的值。 值大於1則產生無法預測的結果。
適用於
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>
一個結構陣列 PointF ,代表定義曲線的點。
- tension
- Single
一個指定曲線在控制點間彎曲幅度的值。 值大於1則產生無法預測的結果。
適用於
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(params System.Drawing.Point[] points);
public void AddCurve(System.Drawing.Point[] points);
member this.AddCurve : System.Drawing.Point[] -> unit
Public Sub AddCurve (ParamArray points As Point())
Public Sub AddCurve (points As Point())
參數
範例
如需範例,請參閱 AddClosedCurve(Point[], Single)。
備註
如果需要,使用者必須保留原始點數。 原始點內部會轉換為立方貝塞爾控制點,因此沒有機制可返回原始點。
適用於
AddCurve(ReadOnlySpan<PointF>)
為目前圖形加入樣條曲線。
public:
void AddCurve(ReadOnlySpan<System::Drawing::PointF> points);
public void AddCurve(scoped ReadOnlySpan<System.Drawing.PointF> points);
member this.AddCurve : ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub AddCurve (points As ReadOnlySpan(Of PointF))
參數
- points
- ReadOnlySpan<PointF>
一個結構陣列 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>
一個結構陣列 PointF ,代表定義曲線的點。
適用於
AddCurve(PointF[])
為目前圖形加入樣條曲線。 使用基數樣條曲線是因為曲線會通過陣列中的每個點。
public:
void AddCurve(... cli::array <System::Drawing::PointF> ^ points);
public:
void AddCurve(cli::array <System::Drawing::PointF> ^ points);
public void AddCurve(params System.Drawing.PointF[] points);
public void AddCurve(System.Drawing.PointF[] points);
member this.AddCurve : System.Drawing.PointF[] -> unit
Public Sub AddCurve (ParamArray points As PointF())
Public Sub AddCurve (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)。
備註
如果需要,使用者必須保留原始點數。 原始點內部會轉換為立方貝塞爾控制點,因此沒有機制可返回原始點。