Hello:
I want to color the background of the header of a CListCtrl control.
Could anyone help me!
Thanks.
Printable View
Hello:
I want to color the background of the header of a CListCtrl control.
Could anyone help me!
Thanks.
if you want is changing color of main column list of CListCtrl...
i tried this, and i could not this, but, finally, i did....write for memory
1.make sub class of CHeaderCtrl. it is a derived class of CHeaderCtrl.
2.massage fuction about NM_CUSTOMDRAW is needed..
3.if above is ok, the function like "void ~~~::OnNMCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)" are made.
4.code is..
void COwnHeader::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
//for this notification, the structure is actually a
// NMLVCUSTOMDRAW that tells you what's going on with the custom
// draw action. So, we'll need to cast the generic pNMHDR pointer.
LPNMCUSTOMDRAW lplvcd = (LPNMCUSTOMDRAW)pNMHDR;
switch(lplvcd->dwDrawStage)
{
case CDDS_PREPAINT:
*pResult = CDRF_NOTIFYITEMDRAW;
break;
case CDDS_ITEMPREPAINT:
{
CDC *pDC_ = CDC::FromHandle(lplvcd->hdc);
CRect rcItem(lplvcd->rc);
pDC_->FillSolidRect(rcItem, m_clrBk);
}
break;
default:// it wasn't a notification that was interesting to us.
*pResult = CDRF_DODEFAULT;
break;
}
}
The OP has probably solved this himself, or given up, or died, or moved to an isolated island
in the past 11 years!
This seems to be quite common lately. CodeGuru should install that vBulletin plugin that warns you when you're about to reply to an old thread like this. (Or does it already? I've never tried. :p)