ListView-CustomDraw
C / C++ / MFC
1
Posts
1
Posters
0
Views
1
Watching
-
This code is taken from "http://www.codeproject.com/KB/list/lvcustomdraw.aspx" an MFC project. i made changes in the code to suitable for a Win32 project. But this code is not working. i am able to get CDDS_PREPAINT but not ITEMPREPAINT or (CDDS_ITEMPREPAINT | CDDS_SUBITEM).
if( ((NMHDR*)lParam)->code == NM_CUSTOMDRAW )
{
pLVCD = reinterpret_cast<nmlvcustomdraw*>( lParam );if ( CDDS\_PREPAINT == pLVCD->nmcd.dwDrawStage ) { return CDRF\_NOTIFYITEMDRAW; } else if ( CDDS\_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage ) { return CDRF\_NOTIFYSUBITEMDRAW; } else if ( (CDDS\_ITEMPREPAINT | CDDS\_SUBITEM) == pLVCD->nmcd.dwDrawStage ) { COLORREF crText, crBkgnd; if ( 0 == pLVCD->iSubItem ) { crText = RGB(255,0,0); crBkgnd = RGB(128,128,255); } else if ( 1 == pLVCD->iSubItem ) { crText = RGB(0,255,0); crBkgnd = RGB(255,0,0); } else { crText = RGB(128,128,255); crBkgnd = RGB(0,0,0); } pLVCD->clrText = crText; pLVCD->clrTextBk = crBkgnd; return CDRF\_DODEFAULT; }
}
Thanks & Regards