Windows API Guide: EndDoc Function


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.

hdc
A device context to the device to fill a rectangular area of.
lpRect
The coordinates of the rectangular area to fill.
hBrush
A handle to the brush to use to fill in the rectangular area.

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



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net