FillRgn Function

Declare Function FillRgn Lib "gdi32.dll" (ByVal hdc As Long, ByVal hRgn As Long, ByVal hBrush As Long) As Long

Platforms: Win 32s, Win 95/98, Win NT

FillRgn fills the area defined by a region on a device. Instead of using the device's currently selected brush, the region is filled using a brush passed to the function. The boundary of the region is not drawn; only its area is filled. The function returns 0 if an error occured, or a non-zero value if successful.

hdc
A device context to the device to fill a region of.
hRgn
A handle to the region on the device to fill.
hBrush
A handle to the brush to use to fill the region.

Example:

' This code is licensed according to the terms and conditions listed here.

' Use the light-gray solid stock brush to fill an elliptical region on window
' Form1.  The bounding rectangle of the ellipse is (30,20)-(150,110).
Dim hrgn As Long  ' handle to the region to fill
Dim hbrush As Long  ' handle to the brush to fill the region with
Dim retval As Long  ' return value

' First, get a handle to the stock light-gray solid brush.
hbrush = GetStockObject(LTGRAY_BRUSH)
' Next, create the elliptical region and get a handle to it.
hrgn = CreateEllipticRgn(30, 20, 150, 110)
' Fill the region using the light-gray brush.
retval = FillRgn(Form1.hDC, hrgn, hbrush)
' Delete the region to free resources.  The stock brush does not need to be deleted.
retval = DeleteObject(hrgn)

See Also: FillRect, FrameRgn
Category: Regions

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/f/fillrgn.html