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

GraphicsPath::AddCurve 方法将基数样条添加到此路径的当前图形中。

语法

Status AddCurve(
  const PointF *points,
  INT          count
);

参数

points

指向定义基数样条的点数组的指针。 基数样条是一条穿过数组中每个点的曲线。

count

指定点数组中的元素数的整数。

返回值

类型:状态

如果该方法成功,则返回 Ok,这是 Status 枚举的元素。

如果方法失败,它将返回 Status 枚举的其他元素之一。

注解

如果以后需要这些点,则应保留点数组的副本。 GraphicsPath 对象不存储传递给 AddClosedCurve 方法的点;相反,它将基数样条转换为贝塞尔样条序列,并存储定义这些贝塞尔样条的点。 无法从 GraphicsPath 对象中检索原始的点数组。

示例

以下示例创建 GraphicsPath 对象路径,将基数样条添加到 path,然后绘制路径。

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);
   // Draw the path.
   Pen pen(Color(255, 255, 0, 0));
   graphics.DrawPath(&pen, &path);
}

要求

要求
Header gdipluspath.h

另请参阅

AddBezier 方法

AddBeziers 方法

AddCurve 方法

贝塞尔曲线

使用区域进行剪裁

构造并绘制轨迹

创建路径渐变

绘制贝塞尔自由绘制曲线

GraphicsPath

路径

Point