共用方式為


GraphicsPath::AddCurve (constPointF*,INT,REAL) 方法 (gdipluspath.h)

GraphicsPath::AddCurve 方法會將基數曲線新增至此路徑的目前圖。

語法

Status AddCurve(
  [in] const PointF *points,
  [in] INT          count,
  [in] REAL         tension
);

參數

[in] points

類型: const PointF*

定義基數曲線之點陣列的指標。 基數曲線是通過陣列中每個點的曲線。

[in] count

類型: INT

整數,指定 陣列中的項目數目。

[in] tension

類型: REAL

非負實數,可控制曲線的長度,以及曲線彎曲的方式。 值為 0 指定曲線是直線線段的序列。 隨著值增加,曲線會變得更完整。

傳回值

類型: 狀態

如果方法成功,它會傳回Ok,這是 Status 列舉的元素。

如果方法失敗,它會傳回 Status 列舉的其中一個其他元素。

備註

如果稍後需要這些點,您應該保留 陣列的複本。 GraphicsPath 物件不會儲存傳遞至 AddClosedCurve 方法的點;相反地,它會將基數曲線轉換成一連串的 Bézier 曲線,並儲存定義這些 Bézier 曲線的點。 您無法從 GraphicsPath 物件擷取原始的點陣列。

範例

下列範例會建立 GraphicsPath 物件 路徑、將基數曲線新增至 路徑,然後繪製 路徑。 此壓力設定為 1.0。

VOID AddCurveExample(HDC hdc)
{
   Graphics graphics(hdc);
   PointF pts[] = {PointF(50.0f, 50.0f),
                   PointF(60.0f, 20.0f),
                   PointF(70.0f, 100.0f),
                   PointF(80.0f, 50.0f)};
   GraphicsPath path;
   path.AddCurve(pts, 4, 1.0f);
   // Draw the path.
   Pen pen(Color(255, 255, 0, 0));
   graphics.DrawPath(&pen, &path);   
}

規格需求

需求
最低支援的用戶端 Windows XP、Windows 2000 Professional [僅限傳統型應用程式]
最低支援的伺服器 Windows 2000 Server [僅限傳統型應用程式]
目標平台 Windows
標頭 gdipluspath.h (包含 Gdiplus.h)
程式庫 Gdiplus.lib
Dll Gdiplus.dll

另請參閱

AddBezier 方法

AddBeziers 方法

AddClosedCurve 方法

AddCurve 方法

基本曲線

使用區域裁剪

建構和繪製路徑

建立路徑漸層

繪製基數曲線

GraphicsPath

路徑

PointF