Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. NM_CUSTOMDRAW in an ATL dialog based application

NM_CUSTOMDRAW in an ATL dialog based application

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aks
    wrote on last edited by
    #1

    I have an ATL dialog based applications. I have a custom list control derived from CListCtrl with message map BEGIN_MESSAGE_MAP( MyListCtrl, CListCtrl ) ON_NOTIFY_REFLECT( NM_CUSTOMDRAW, &MyListCtrl::OnNMCustomDraw ) END_MESSAGE_MAP() void MyListCtrl, ::OnNMCustomDraw( NMHDR *pNMHDR, LRESULT *pResult ) { NMLVCUSTOMDRAW* pLVCD = reinterpret_cast( pNMHDR); // Take the default processing *pResult = CDRF_DODEFAULT; if( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage ) { *pResult = CDRF_NOTIFYITEMDRAW; } else if( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage ) { int nRow = static_cast(pLVCD->nmcd.dwItemSpec ); if( true == MyArray[nRow].bIsOlder ) { pLVCD->clrText = RGB( 128, 128, 128 ); } pResult = CDRF_DODEFAULT; } } But I am not getting ant reflected message from the parent dialog. I know that it can be done by using the REFLECT_NOTIFICATIONS() in the parent class. But I read that we have to derive the CListCtrl from CContained window. Is it the right way, if so what are things I have to take care. Is there any better solution to resolve this issue?

    aks

    L 1 Reply Last reply
    0
    • A aks

      I have an ATL dialog based applications. I have a custom list control derived from CListCtrl with message map BEGIN_MESSAGE_MAP( MyListCtrl, CListCtrl ) ON_NOTIFY_REFLECT( NM_CUSTOMDRAW, &MyListCtrl::OnNMCustomDraw ) END_MESSAGE_MAP() void MyListCtrl, ::OnNMCustomDraw( NMHDR *pNMHDR, LRESULT *pResult ) { NMLVCUSTOMDRAW* pLVCD = reinterpret_cast( pNMHDR); // Take the default processing *pResult = CDRF_DODEFAULT; if( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage ) { *pResult = CDRF_NOTIFYITEMDRAW; } else if( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage ) { int nRow = static_cast(pLVCD->nmcd.dwItemSpec ); if( true == MyArray[nRow].bIsOlder ) { pLVCD->clrText = RGB( 128, 128, 128 ); } pResult = CDRF_DODEFAULT; } } But I am not getting ant reflected message from the parent dialog. I know that it can be done by using the REFLECT_NOTIFICATIONS() in the parent class. But I read that we have to derive the CListCtrl from CContained window. Is it the right way, if so what are things I have to take care. Is there any better solution to resolve this issue?

      aks

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Are you certain that this works in ATL? According to http://msdn.microsoft.com/en-us/library/eeah46xd.aspx[^], this is only for MFC 4.0.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups