Declare Function FillRect Lib "user32.dll" (ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Platforms: Win 32s, Win 95/98, Win NT
FillRect fills a rectangular area on a device using the specified brush. The outline of the rectangular area is not drawn, and the bottom and right edges of the given rectangle are not filled in (they are not considered to be part of the interior of the rectangle). Note that this function uses the brush passed to the function, so it is not necessary to use SelectObject to have the device select the brush first. The function returns 1 if successful, or 0 if an error occured.
Example:
' Use a blue diagonal-cross hatched brush to fill in a rectangular
' area on window Form1. The rectangular area has coordinates (20,25)-(200,175).
Dim hbrush As Long ' receives handle to the blue hatched brush to use
Dim r As RECT ' rectangular area to fill
Dim retval As Long ' return value
' Set the coordinates of the rectangle r
retval = SetRect(r, 20, 25, 200, 175) ' now r = (20,25)-(200,175)
' Create a blue diagonal-cross hatched brush
hbrush = CreateHatchBrush(HS_DIAGCROSS, RGB(0, 0, 255))
' Fill in the desired rectangular area
retval = FillRect(Form1.hDC, r, hbrush) ' fill the rectangle using the brush
' Delete the brush we created in order to free up resources
retval = DeleteObject(hbrush)
See Also: FillRgn, FrameRect
Category: Filled Shapes
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/fillrect.html