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>createpatternbrush()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
CreatePatternBrush()
Create a brush with a pattern specified by a bitmap
------------------------------------------------------------------------------

Syntax
CreatePattternBrush( <hBitmap> )   -->   hBrush

Arguments
<hBitmap> is the handle of the bitmap.

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 and released the device context.

Example
// Fill an area using a bitmap brush
hDC = GetDC( hWnd )
     . . .
hBmp = LoadBitmap( , ID_MYBITMAP )
hBmpBrush = CreatePatternBrush( hBmp )
hOldBrush = SelectObject( hDC, hBmpBrush )
Rectangle( hDC, 100, 100, 50, 50 )
SelectObject( hDC, hOldBrush )
DeleteObject( hBmpBrush )
     . . .
ReleaseDC( hWnd, hDC )

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

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