L_ILM_DRAWITEM

Send this message to draw/paint the specified item in the ImageList Control's parent window.

Parameters

wParam

0-not used.

lParam

Pointer to an LILDRAWITEM structure that contains information about the item to be drawn/painted.

Returns

Value Meaning
ERROR_USER_ABORT The ImageList Control will not do any further drawing/painting of the specified item.
<> ERROR_USER_ABORT The ImageList Control will draw/paint the item normally.

Comments

The LILDRAWITEM structure pointed to by lParam specifies the information to draw/paint.

The user is responsible for any objects created during the processing of this message. In addition, the user is also responsible for returning the HDC to its original state before returning from the processing of this message.

See Also

Elements

Topics

Example

this function processes all the messages for a window

L_INT32  MainWndProc8(HWND hWnd, L_UINT Message, WPARAM wParam,LPARAM lParam) 
{ 
   pLILDRAWITEM pdi=NULL; 
 
   switch (Message) 
   { 
      case ILM_DRAWITEM: 
         pdi=(pLILDRAWITEM)lParam; 
         if(pdi) 
         { 
            if(pdi->pItem) 
            { 
               HRGN hRgn1=NULL; 
               HRGN hRgn2=NULL; 
               HBRUSH hBrush=NULL; 
               RECT rcMyItem; 
               SaveDC(pdi->hDC); 
               CopyRect(&rcMyItem, &pdi->rcItem); 
               InflateRect(&rcMyItem, -10, -10); 
               hRgn1 = CreateEllipticRgn(pdi->rcItemBack.left, 
                                         pdi->rcItemBack.top, 
                                         pdi->rcItemBack.right, 
                                         pdi->rcItemBack.bottom); 
               hRgn2 = CreateEllipticRgn(rcMyItem.left, 
                                         rcMyItem.top, 
                                         rcMyItem.right, 
                                         rcMyItem.bottom); 
               if(pdi->pItem->bSelected) 
                  hBrush=(HBRUSH)GetStockObject(WHITE_BRUSH); 
               else 
                  hBrush=(HBRUSH)GetStockObject(BLACK_BRUSH); 
               SelectObject(pdi->hDC, hBrush); 
               SelectObject(pdi->hDC, hRgn1); 
               Rectangle(pdi->hDC, pdi->rcItemBack.left, 
                                   pdi->rcItemBack.top, 
                                   pdi->rcItemBack.right, 
                                   pdi->rcItemBack.bottom); 
               SelectObject(pdi->hDC, hRgn2); 
               L_PaintDC(pdi->hDC, pdi->pItem->pBitmap, 
                         NULL, NULL, &rcMyItem, NULL, SRCCOPY); 
               if(pdi->pItem->pText && lstrlen(pdi->pItem->pText)) 
                  DrawText(pdi->hDC, pdi->pItem->pText, 
                  lstrlen(pdi->pItem->pText), &rcMyItem, 
                  DT_SINGLELINE|DT_BOTTOM|DT_END_ELLIPSIS);  
               DeleteObject(hRgn1); 
               DeleteObject(hRgn2); 
               RestoreDC(pdi->hDC, -1); 
               return ERROR_USER_ABORT;//I did the drawing 
            } 
         } 
         //I did not do the drawing 
      //other cases here............... 
      //for other window messages...... 
   } 
   return DefWindowProc(hWnd, Message, wParam, lParam); 
   return SUCCESS; 
} 

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

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.