Partager via


NM_CUSTOMDRAW (Windows Embedded CE 6.0)

1/6/2010

This message is sent by some common controls to notify their parent windows about drawing operations. The message is sent in the form of a WM_NOTIFY message.

Syntax

NM_CUSTOMDRAW
#ifdef LIST_VIEW_CUSTOM_DRAW
    lpNMCustomDraw = (LPNMLVCUSTOMDRAW) lParam;
#elif TOOL_TIPS_CUSTOM_DRAW
    lpNMCustomDraw = (LPNMTTCUSTOMDRAW) lParam;
#elif TREE_VIEW_CUSTOM_DRAW
    lpNMCustomDraw = (LPNMTVCUSTOMDRAW) lParam;
#else
    lpNMCustomDraw = (LPNMCUSTOMDRAW) lParam;
#endif

Parameters

  • lpNMCustomDraw
    Long pointer to a custom draw-related structure that contains information about the drawing operation. The following table lists the controls that send the NM_CUSTOMDRAW message and their associated structures.

    Control Structure

    List view

    NMLVCUSTOMDRAW

    ToolTips

    NMTTCUSTOMDRAW

    Tree view

    NMTVCUSTOMDRAW

    All other supported controls

    NMCUSTOMDRAW

Return Value

The value your application can return depends on the current drawing stage. The dwDrawStage member of the associated NMCUSTOMDRAW structure holds a value that specifies the drawing stage.

You must return one of the following values when dwDrawStage equals CDDS_PREPAINT:

  • CDRF_DODEFAULT
    The control will draw itself. It will not send any additional NM_CUSTOMDRAW messages for this paint cycle.
  • CDRF_NOTIFYITEMDRAW
    The control will notify the parent of any item-related drawing operations. It will send NM_CUSTOMDRAW messages before and after drawing items.
  • CDRF_NOTIFYITEMERASE
    The control will notify the parent when an item will be erased. It will send NM_CUSTOMDRAW messages before and after erasing items.
  • CDRF_NOTIFYPOSTERASE
    The control will notify the parent after erasing an item.
  • CDRF_NOTIFYPOSTPAINT
    The control will notify the parent after painting an item.

You must return one of the following values when dwDrawStage equals CDDS_ITEMPREPAINT:

  • CDRF_NEWFONT
    Your application specified a new font for the item; the control will use the new font. **For more information on changing fonts, see Changing Fonts and Colors. **
  • CDRF_SKIPDEFAULT
    Your application drew the item manually. The control will not draw the item.

Remarks

Currently header, list view, rebar, toolbar, ToolTip, trackbar, and tree view controls support custom draw functionality. The ToolTip control supports custom draw for Windows Embedded CE.

Example

case WM_NOTIFY:
   {
       LPNMHDR lpnm = (LPNMHDR) lParam;
       // Check for the dropdown notification
       if (lpnm->hwndFrom == p_stParams->hwndToolBar)
       {
           switch (lpnm->code)
           {
               case NM_CUSTOMDRAW:
               {
                   NMCUSTOMDRAW *pnmcd = (NMCUSTOMDRAW *)lParam;
                   switch (pnmcd->dwDrawStage)
                   {
                       case CDDS_ITEMPREPAINT:
                           if (pnmcd->dwItemSpec == IDM_HEADER_SHOWBY_SUBMENU)
                           {
                               SetWindowLong(hDlg, DWL_MSGRESULT, (LONG)CDRF_NOVERTBAR);
                               return TRUE;
                           }
                           break;
                       default:
                           break;
                   }
               }
               default:
                   break;
           }
       }
   }

Requirements

Header commctrl.h
Windows Embedded CE Windows CE 2.0 and later

See Also

Reference

Custom Draw Messages
WM_NOTIFY
NMCUSTOMDRAW
NMLVCUSTOMDRAW