如何设置WTL控件CListViewCtrl中的某一行的颜色
1个回答
2014-12-28 · 知道合伙人数码行家
huanglenzhi
知道合伙人数码行家
向TA提问 私信TA
知道合伙人数码行家
采纳数:117538
获赞数:517189
长期从事计算机组装,维护,网络组建及管理。对计算机硬件、操作系统安装、典型网络设备具有详细认知。
向TA提问 私信TA
关注
展开全部
NOTIFY_HANDLER(IDC_LIST1, NM_CUSTOMDRAW, OnNMCustomdrawList1)
LRESULT OnNMCustomdrawList1(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
LRESULT CMainDlg::OnNMCustomdrawList1(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/)
{
LPNMLVCUSTOMDRAW pLVNMCD = reinterpret_cast< LPNMLVCUSTOMDRAW>(pNMHDR);
int nResult = CDRF_DODEFAULT;
if (CDDS_PREPAINT == pLVNMCD->nmcd.dwDrawStage)
{
nResult = CDRF_NOTIFYITEMDRAW;
}
else if (CDDS_ITEMPREPAINT == pLVNMCD->nmcd.dwDrawStage)
{
nResult = CDRF_NOTIFYSUBITEMDRAW;
}
else if (pLVNMCD->nmcd.dwDrawStage == (CDDS_ITEMPREPAINT|CDDS_SUBITEM))
{
//单双行不同颜色
if (pLVNMCD->nmcd.dwItemSpec%2 == 0)
{
pLVNMCD->clrText = RGB(60, 128, 160);
}
else
{
pLVNMCD->clrText = RGB(80, 160, 80);
}
}
return nResult;
}
LRESULT OnNMCustomdrawList1(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
LRESULT CMainDlg::OnNMCustomdrawList1(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/)
{
LPNMLVCUSTOMDRAW pLVNMCD = reinterpret_cast< LPNMLVCUSTOMDRAW>(pNMHDR);
int nResult = CDRF_DODEFAULT;
if (CDDS_PREPAINT == pLVNMCD->nmcd.dwDrawStage)
{
nResult = CDRF_NOTIFYITEMDRAW;
}
else if (CDDS_ITEMPREPAINT == pLVNMCD->nmcd.dwDrawStage)
{
nResult = CDRF_NOTIFYSUBITEMDRAW;
}
else if (pLVNMCD->nmcd.dwDrawStage == (CDDS_ITEMPREPAINT|CDDS_SUBITEM))
{
//单双行不同颜色
if (pLVNMCD->nmcd.dwItemSpec%2 == 0)
{
pLVNMCD->clrText = RGB(60, 128, 160);
}
else
{
pLVNMCD->clrText = RGB(80, 160, 80);
}
}
return nResult;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询