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 ) ; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Digital Paint C API Help