GraphicsPath::AddRectangles (constRectF*,INT) 方法 (gdipluspath.h)

GraphicsPath::AddRectangles 方法将矩形序列添加到此路径。

语法

Status AddRectangles(
  const RectF *rects,
  INT         count
);

参数

rects

指向将添加到路径的矩形数组的指针。

count

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

返回值

Type:Status

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

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

注解

示例

以下示例创建 一个 GraphicsPath 对象路径,将两个矩形添加到 path,然后绘制路径。

VOID Example_AddRectangles(HDC hdc)
{
   Graphics graphics(hdc);

   RectF rects[] = {RectF(20.0f, 20.0f, 100.0f, 50.0f),
                    RectF(30.0f, 30.0f, 50.0f, 100.0f)};

   GraphicsPath path;
   path.AddRectangles(rects, 2);

   // Draw the path.
   Pen pen(Color(255, 255, 0, 0));
   graphics.DrawPath(&pen, &path);
}

要求

要求
Header gdipluspath.h

另请参阅

AddRectangle 方法

AddRectangles 方法

使用区域进行剪裁

构造并绘制轨迹

创建路径渐变

GraphicsPath

路径

笔、线条和矩形

RectF

使用笔绘制线条和矩形