Graphics.FillRegion method

Applies to: desktop apps only

The Graphics::FillRegion method uses a brush to fill a specified region.

Syntax

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

Parameters

brush [in]

Type: const Brush*

Pointer to a brush that is used to paint the region.

region [in]

Type: const Region*

Pointer to a region to be filled.

Return value

Type:

Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

Remarks

Because a region describes a set of pixels, a pixel is considered either fully inside, or fully outside the region. Consequently, Graphics::FillRegion does not antialias the edges of the region.

Examples

The following example creates a region from a rectangle and then fills the region.


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);
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusgraphics.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Graphics
Color
Pen
Region
Status
Regions

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show: