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 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Digital Paint C API Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.