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

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

語法

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

參數

[in] points

類型: const Point*

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

[in] count

類型: INT

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

[in] tension

類型: REAL

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

傳回值

類型: 狀態

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

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

備註

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

範例

下列範例會建立 GraphicsPath 物件,並呼叫 GraphicsPath::AddCurve 方法,將基數曲線新增至路徑。 傳遞至 GraphicsPath::AddCurve 的第三個自變數會指定基數曲線的指標。

VOID AddCurveExample(HDC hdc)
{
   Graphics graphics(hdc);
   Point pts[] = {Point(50, 50),
                  Point(60, 20),
                  Point(70, 100),
                  Point(80, 50)};
   GraphicsPath path;
   path.AddCurve(pts, 4);
   // Draw the path.
   Pen pen(Color(255, 255, 0, 0));
   graphics.DrawPath(&pen, &path);   
}
Color(255, 255, 0,  0)

規格需求

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

另請參閱

AddBezier 方法

AddBeziers 方法

AddClosedCurve 方法

AddCurve 方法

基本曲線

使用區域裁剪

建構和繪製路徑

建立路徑漸層

繪製基數曲線

GraphicsPath

路徑