关于CtrlTree设置单独Item颜色的有关问题

关于CtrlTree设置单独Item颜色的问题
代码在下面,就1个问题,鼠标点上去为什么会闪烁。。

BOOL CtestDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
LPNMHDR pNmhdr = (LPNMHDR)lParam;

switch (pNmhdr->code)
{
case NM_CUSTOMDRAW:
{
LPNMTVCUSTOMDRAW pCustomDraw = (LPNMTVCUSTOMDRAW)lParam;
switch (pCustomDraw->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
// Need to process this case and set pResult to CDRF_NOTIFYITEMDRAW, 
// otherwise parent will never receive CDDS_ITEMPREPAINT notification. (GGH) 
*pResult = CDRF_NOTIFYITEMDRAW;
return true;

case CDDS_ITEMPREPAINT:
switch (pCustomDraw->iLevel)
{
// painting all 0-level items blue,
// and all 1-level items red (GGH)
case 0:
if (pCustomDraw->nmcd.uItemState == (CDIS_FOCUS | CDIS_SELECTED)) // selected
pCustomDraw->clrText = RGB(255, 255, 255);
else
pCustomDraw->clrText = RGB(0, 0, 255);
break;
case 1:
if (pCustomDraw->nmcd.uItemState == (CDIS_FOCUS | CDIS_SELECTED)) // selected
pCustomDraw->clrText = RGB(255, 255, 255);
else
pCustomDraw->clrText = RGB(255, 0, 0);
break;
}

*pResult = CDRF_SKIPDEFAULT;
return false;

}
}
break;
}

return CDialog::OnNotify(wParam, lParam, pResult);
}



------解决方案--------------------
dlg 的 .h
afx_msg void OnCustDrawTree(NMHDR *pNMHDR,LRESULT *pResult);
dlg 的 .cpp
ON_NOTIFY(NM_CUSTOMDRAW, IDC_TREE1,OnCustDrawTree)

void CTreectrlDlg::OnCustDrawTree(NMHDR *pNMHDR,LRESULT *pResult)
{
}