NM_CUSTOMDRAW in an ATL dialog based application
-
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
-
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