la solution :
header:
class CCustListCtrl : public CListCtrl
{
public:
CCustListCtrl();
//{{AFX_VIRTUAL(CCustListCtrl)
//}}AFX_VIRTUAL
virtual ~CCustListCtrl();
protected:
//{{AFX_MSG(CCustListCtrl)
afx_msg void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
cpp:
CCustListCtrl::CCustListCtrl()
{
}
CCustListCtrl::~CCustListCtrl()
{
}
BEGIN_MESSAGE_MAP(CCustListCtrl, CListCtrl)
//{{AFX_MSG_MAP(CCustListCtrl)
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// CCustListCtrl message handlers
void CCustListCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)pNMHDR;
switch(lplvcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
*pResult = CDRF_NOTIFYITEMDRAW;
break;
case CDDS_ITEMPREPAINT:
if(lplvcd->nmcd.dwItemSpec % 2)
{
lplvcd->clrText = RGB(128, 30, 30);
lplvcd->clrTextBk = RGB(255,255,220);
}
else{
lplvcd->clrText = RGB(0, 0, 0);
lplvcd->clrTextBk = RGB(230,230,230);
}
*pResult = CDRF_DODEFAULT;
break;
}
}