标签:
http://zhidao.baidu.com/link?url=BKp05mfOdKbEBh21svQelpVhYjzDkIpYUZay8_3ZLSndTQn5kK0eTwQG8jBvYnwh8USFHoMPmozWw5odO2LN__
void CSendCommandDlg::OnNMCustomdrawList2(NMHDR *pNMHDR, LRESULT *pResult)
{
NMLVCUSTOMDRAW* lplvcd = (NMLVCUSTOMDRAW*)(pNMHDR);
int nRow = (int)lplvcd->nmcd.dwItemSpec;
switch (lplvcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT:
*pResult |= CDRF_NOTIFYITEMDRAW;
break;
case CDDS_ITEMPREPAINT:// 单行与双行的颜色
{
if (nRow &1)//// 单行
{
lplvcd->clrTextBk = RGB(0xFF,0xFF,0xFF);
lplvcd->clrText = RGB(0x00,0x00,0x00);
*pResult = CDRF_NEWFONT;
}else // 双行
{
lplvcd->clrTextBk = RGB(0xBB,0xCC,0xFF);
lplvcd->clrText = RGB(0x44,0x33,0x00);
*pResult = CDRF_NEWFONT;
}
if (m_List.GetCheck(nRow) && (m_List.GetExtendedStyle()& LVS_EX_CHECKBOXES))
{
lplvcd->clrTextBk = RGB(0x00,0x00,0x80);
lplvcd->clrText = RGB(0xFF,0xFF,0x00);
HFONT hFont = (HFONT)this->SendMessage(WM_GETFONT);
LOGFONT lf;
GetObject(hFont,sizeof(lf),&lf);
lf.lfStrikeOut = TRUE;// // 删除线
//lf.lfItalic = TRUE;//斜体
hFont = CreateFontIndirect(&lf);
SelectObject(lplvcd->nmcd.hdc,hFont);
DeleteObject(hFont);
*pResult = CDRF_NEWFONT;
}
if (m_List.GetItemState(nRow,CDIS_SELECTED))//选中行颜色
{
lplvcd->nmcd.uItemState &= ~CDIS_SELECTED;
lplvcd->clrTextBk = RGB(255,0,0);
lplvcd->clrText = RGB(0,0,255);
*pResult = CDRF_NEWFONT;
}
}
break;
default:
*pResult = CDRF_DODEFAULT;
break;
}
}
问题:CListCtrl如何高亮选中一行 http://zhidao.baidu.com/question/100664911.html 扩展:单行、双行及完成状态的字体等等。。。
标签:
原文地址:http://www.cnblogs.com/dengpeng1004/p/4530122.html