GraphicsPath.AddClosedCurve 方法

定義

將封閉曲線新增至此路徑。 使用基數曲線曲線,因為曲線會穿過數位中的每個點。

多載

AddClosedCurve(Point[])

將封閉曲線新增至此路徑。 使用基數曲線曲線,因為曲線會穿過數位中的每個點。

AddClosedCurve(PointF[])

將封閉曲線新增至此路徑。 使用基數曲線曲線,因為曲線會穿過數位中的每個點。

AddClosedCurve(ReadOnlySpan<Point>)
AddClosedCurve(ReadOnlySpan<PointF>)
AddClosedCurve(Point[], Single)

將封閉曲線新增至此路徑。 使用基數曲線曲線,因為曲線會穿過數位中的每個點。

AddClosedCurve(PointF[], Single)

將封閉曲線新增至此路徑。 使用基數曲線曲線,因為曲線會穿過數位中的每個點。

AddClosedCurve(ReadOnlySpan<Point>, Single)
AddClosedCurve(ReadOnlySpan<PointF>, Single)

AddClosedCurve(Point[])

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs

將封閉曲線新增至此路徑。 使用基數曲線曲線,因為曲線會穿過數位中的每個點。

C#
public void AddClosedCurve (System.Drawing.Point[] points);
C#
public void AddClosedCurve (params System.Drawing.Point[] points);

參數

points
Point[]

Point 結構的陣列,表示定義曲線的點。

範例

如需範例,請參閱 AddClosedCurve(Point[], Single)

備註

如果需要,用戶必須保留原始點。 原始點會在內部轉換成立方貝塞爾控制點,因此沒有傳回原始點的機制。 如果 points 陣列中的第一個點和最後一個點不相同,則曲線會連接這兩個點來關閉。 這個方法無法設定緊張值,且預設為等於 0.5 的值。

適用於

.NET 9 及其他版本
產品 版本
.NET 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

AddClosedCurve(PointF[])

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs

將封閉曲線新增至此路徑。 使用基數曲線曲線,因為曲線會穿過數位中的每個點。

C#
public void AddClosedCurve (System.Drawing.PointF[] points);
C#
public void AddClosedCurve (params System.Drawing.PointF[] points);

參數

points
PointF[]

PointF 結構的陣列,表示定義曲線的點。

範例

如需範例,請參閱 AddClosedCurve(Point[], Single)

備註

如果需要,用戶必須保留原始點。 原始點會在內部轉換成立方貝塞爾控制點,因此沒有傳回原始點的機制。 如果 points 陣列中的第一個點和最後一個點不相同,則曲線會連接這兩個點來關閉。 這個方法無法設定緊張值,且預設為等於 0.5 的值。

適用於

.NET 9 及其他版本
產品 版本
.NET 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

AddClosedCurve(ReadOnlySpan<Point>)

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
C#
public void AddClosedCurve (scoped ReadOnlySpan<System.Drawing.Point> points);

參數

適用於

.NET 9 和 Windows Desktop 9
產品 版本
.NET 9
Windows Desktop 9

AddClosedCurve(ReadOnlySpan<PointF>)

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
C#
public void AddClosedCurve (scoped ReadOnlySpan<System.Drawing.PointF> points);

參數

適用於

.NET 9 和 Windows Desktop 9
產品 版本
.NET 9
Windows Desktop 9

AddClosedCurve(Point[], Single)

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs

將封閉曲線新增至此路徑。 使用基數曲線曲線,因為曲線會穿過數位中的每個點。

C#
public void AddClosedCurve (System.Drawing.Point[] points, float tension);

參數

points
Point[]

Point 結構的陣列,表示定義曲線的點。

tension
Single

介於 0 到 1 之間的值,指定曲線在點之間彎曲的數量,0 是最小的曲線(最尖角),1 是最平滑的曲線。

範例

下列程式代碼範例的設計目的是要與 Windows Forms 搭配使用,而且需要 PaintEventArgseOnPaint 事件物件。 程式代碼會執行下列動作:

  • 建立六個點的陣列(代表基數曲線)。

  • 建立路徑,並將封閉的基數曲線新增至路徑(從端點關閉至起點)。

  • 繪製畫面的路徑。

請注意,使用 0.5 的緊張。

C#
private void AddClosedCurveExample(PaintEventArgs e)
{
             
    // Creates a symmetrical, closed curve.
    Point[] myArray =
             {
                 new Point(20,100),
                 new Point(40,150),
                 new Point(60,125),
                 new Point(40,100),
                 new Point(60,75),
                 new Point(40,50)
             };
             
    // Create a new path and add curve.
    GraphicsPath myPath = new GraphicsPath();
    myPath.AddClosedCurve(myArray,.5f);
    Pen myPen = new Pen(Color.Black, 2);
             
    // Draw the path to screen.
    e.Graphics.DrawPath(myPen, myPath);
}

備註

如果需要,用戶必須保留原始點。 原始點會在內部轉換成立方貝塞爾控制點,因此沒有傳回原始點的機制。 如果 points 陣列中的第一個點和最後一個點不相同,則曲線會連接這兩個點來關閉。

適用於

.NET 9 及其他版本
產品 版本
.NET 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

AddClosedCurve(PointF[], Single)

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
來源:
GraphicsPath.cs

將封閉曲線新增至此路徑。 使用基數曲線曲線,因為曲線會穿過數位中的每個點。

C#
public void AddClosedCurve (System.Drawing.PointF[] points, float tension);

參數

points
PointF[]

PointF 結構的陣列,表示定義曲線的點。

tension
Single

介於 0 到 1 之間的值,指定曲線在點之間彎曲的數量,0 是最小的曲線(最尖角),1 是最平滑的曲線。

範例

如需範例,請參閱 AddClosedCurve(Point[], Single)

備註

如果需要,用戶必須保留原始點。 原始點會在內部轉換成立方貝塞爾控制點,因此沒有傳回原始點的機制。 如果 points 陣列中的第一個點和最後一個點不相同,則曲線會連接這兩個點來關閉。

適用於

.NET 9 及其他版本
產品 版本
.NET 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

AddClosedCurve(ReadOnlySpan<Point>, Single)

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
C#
public void AddClosedCurve (ReadOnlySpan<System.Drawing.Point> points, float tension);

參數

tension
Single

適用於

.NET 9 和 Windows Desktop 9
產品 版本
.NET 9
Windows Desktop 9

AddClosedCurve(ReadOnlySpan<PointF>, Single)

來源:
GraphicsPath.cs
來源:
GraphicsPath.cs
C#
public void AddClosedCurve (ReadOnlySpan<System.Drawing.PointF> points, float tension);

參數

tension
Single

適用於

.NET 9 和 Windows Desktop 9
產品 版本
.NET 9
Windows Desktop 9