Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - <b>createsolidbrush()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
CreateSolidBrush()
Create a brush with a solid colour
------------------------------------------------------------------------------

Syntax
CreateSolidBrush( <nColour> )   -->   hBrush

Arguments
<nColour> is the foreground colour to use for the brush.  Use
one of the pre-defined colours (COLOR_* in WINDOWS.CH), or
specify your own using the RGB() macro.

Returns
If successful, a handle to the brush is returned (a non-zero
numeric), otherwise  zero is returned.

Description
The brush is created and a handle returned to the application.
To use the brush, use SelectObject() to select it, then use
the Windows drawing functions such as Ellipse() and
Rectangle().  The interiors of these shapes are filled with
the currently selected brush.  Finally, you can free the
resources associated with the brush using DeleteObject(), BUT
don't call DeleteObject() until you have selected a different
object or released the device context.

Example
// Fill a box with green
hDC = GetDC( hWnd )
     . . .
hGreenBrush = CreateSolidBrush( RGB( 0, 255, 0 ) )
hOldBrush = SelectObject( hDC, hGreenBrush )
Rectangle( hDC, 100, 100, 50, 50 )
SelectObject( hDC, hOldBrush )
DeleteObject( hGreenBrush )
     . . .
ReleaseDC( hWnd, hDC )


See Also: CreateHatchBrush() DeleteObject() GetStockObject() SelectObject()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson