Share via


Graphics::FillRectangle (constBrush*,constRectF&) 方法 (gdiplusgraphics.h)

Graphics::FillRectangle 方法會使用筆刷來填滿矩形的內部。

語法

Status FillRectangle(
  const Brush   *brush,
  const RectF & rect
);

參數

brush

筆刷的指標,用來繪製矩形的內部。

rect

要填滿之矩形的參考。

傳回值

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

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

備註

範例

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

   // Create a SolidBrush object.
   SolidBrush blackBrush(Color(255, 0, 0, 0));

   // Create a RectF object.
   RectF fillRect(1.0f, 2.5f, 100.3f, 100.9f);

   // Fill the rectangle.
   graphics.FillRectangle(&blackBrush, fillRect);
}

規格需求

需求
標頭 gdiplusgraphics.h

另請參閱

圖形

色彩

Rect

StringFormat