Graphics::FillRegion 方法 (gdiplusgraphics.h)

Graphics::FillRegion 方法會使用筆刷來填滿指定的區域。

語法

Status FillRegion(
  [in] const Brush  *brush,
  [in] const Region *region
);

參數

[in] brush

類型: const Brush*

用來繪製區域的筆刷指標。

[in] region

類型: const 區域*

要填入之區域的指標。

傳回值

類型: 狀態

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

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

備註

因為區域描述一組圖元,所以圖元會被視為完全在區域內或完全位於區域內。 因此, Graphics::FillRegion 不會反鋸齒區域邊緣。

範例

下列範例會從矩形建立區域,然後填滿區域。

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

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

   // Create a Region object from a rectangle.
   Region ellipseRegion(Rect(0, 0, 200, 100));

   // Fill the region.
   graphics.FillRegion(&blackBrush, &ellipseRegion);
}

規格需求

需求
最低支援的用戶端 Windows XP、Windows 2000 Professional [僅限桌面應用程式]
最低支援的伺服器 Windows 2000 Server [僅限桌面應用程式]
目標平台 Windows
標頭 gdiplusgraphics.h (包含 Gdiplus.h)
程式庫 Gdiplus.lib
Dll Gdiplus.dll

另請參閱

色彩

圖形

區域

區域

狀態