GraphicsPath::AddRectangle (constRectF&) 方法 (gdipluspath.h)

GraphicsPath::AddRectangle 方法會將矩形新增至此路徑。

語法

Status AddRectangle(
  const RectF & rect
);

參數

rect

要加入路徑之矩形的參考。

傳回值

Type:Status

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

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

備註

範例

下列範例會建立 GraphicsPath 物件路徑、將矩形新增至路徑,然後繪製路徑。

VOID Example_AddRectangle(HDC hdc)
{
   Graphics graphics(hdc);
   RectF rect(20.0f, 20.0f, 100.0f, 50.0f);

   GraphicsPath path;
   path.AddRectangle(rect);

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

規格需求

   
標頭 gdipluspath.h

另請參閱

AddPolygon 方法

使用區域裁剪

建構和繪製路徑

建立路徑漸層

GraphicsPath

路徑

PointF

多邊形