Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
Processing the WM_PAINT Message
The following example demonstrates one way of processing the WM_PAINT message to paint the LEAD bitmap handle.
// This is example assumes, that we have
// a valid LEAD bitmap handle, and the user has
// initialized the necessary paint palette and the
// required bitmap view rectangle to be painted
L_VOID OnPaint ( HWND hWnd )
{
PAINTSTRUCT ps ;
HPALETTE hOldPalette = NULL ;
BeginPaint ( hWnd, &ps ) ;
if ( ( g_PaintBitmap.Flags.Allocated ) )
{
if ( g_PainthPalette != NULL )
{
hOldPalette = SelectPalette ( ps.hdc, g_PainthPalette, TRUE ) ;
RealizePalette ( ps.hdc ) ;
}
L_PaintDC( ps.hdc, &g_PaintBitmap, NULL, NULL, &g_rcBitmapView, &ps.rcPaint, SRCCOPY ) ;
if ( g_PainthPalette != NULL )
{
SelectPalette ( ps.hdc, hOldPalette, TRUE ) ;
}
}
EndPaint ( hWnd, &ps ) ;
}