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>createhatchbrush()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
CreateHatchBrush()
Create a brush with a hatched pattern and colour
------------------------------------------------------------------------------

Syntax
CreateHatchBrush( <nStyle>, <nColour> )   -->   hBrush

Arguments
<nStyle> is one of the HS_* styles (defined in WINDOWS.CH).

<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 an area with horizontal red hatching
hDC = GetDC( hWnd )
     . . .
hRedBrush = CreateHatchBrush( HS_HORIZONTAL, RGB( 255, 0, 0 ) )
hOldBrush = SelectObject( hDC, hRedBrush )
Rectangle( hDC, 100, 100, 50, 50 )
SelectObject( hDC, hOldBrush )
DeleteObject( hRedBrush )
     . . .
ReleaseDC( hDC )


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

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