Share via


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

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

語法

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

參數

[in] points

類型: const PointF*

定義基數曲線之點陣列的指標。 基數曲線是一種曲線,會通過數位中點) 移和 numberOfSegments 參數所指定的子集 (。

[in] count

類型: INT

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

[in] offset

類型: INT

整數,指定做為基數曲線第一個點之陣列專案的索引。

[in] numberOfSegments

類型: INT

整數,指定基數曲線中的區段數目。 區段是連接陣列中連續點的曲線。

[in] tension

類型: REAL

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

傳回值

類型: 狀態

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

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

備註

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

範例

下列範例會建立 GraphicsPath 物件 路徑、將基數曲線新增至 路徑,然後繪製 路徑。 曲線是從索引為 2 到 6 的 8 點陣列中建立的點。

VOID AddCurveExample3(HDC hdc)
{
   Graphics graphics(hdc);
   GraphicsPath path;
   
   PointF pts[] = {PointF(50.0f, 50.0f),
                  PointF(70.0f, 80.0f),
                  PointF(100.0f, 100.0f),
                  PointF(130.0f, 40.0f),
                  PointF(150.0f, 90.0f),
                  PointF(180.0f, 30.0f),
                  PointF(210.0f, 120.0f),
                  PointF(240.0f, 80.0f)};
   path.AddCurve(
      pts, 
      8,     // There are eight points in the array. 
      2,     // Start at the point with index 2.
      4,     // Four segments. End at the point with index 6.
      1.0f);
   Pen pen(Color(255, 0, 0, 255));
   graphics.DrawPath(&pen, &path);
   // Draw all eight points in the array.
   SolidBrush brush(Color(255, 255, 0, 0));
   for(INT j = 0; j <= 7; ++j)
      graphics.FillEllipse(&brush, pts[j].X - 3.0f, pts[j].Y - 3.0f, 6.0f, 6.0f); 
}
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

路徑

PointF