How to set the head backgroud color of CPropertyPage?
In the DrawItem function the TextOut position is pretty half-hearted, and looks a bit better (to my eyes) if you do it something like this instead.
void CMyTabCtrl::DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
CDC* pDC = CDC::FromHandle(lpDIS->hDC);
CRect rc(lpDIS->rcItem);
TCHAR szTabText[255];
TC_ITEM tci;
tci.cchTextMax = sizeof(szTabText)-1;
tci.pszText = szTabText;
tci.mask = TCIF_TEXT;
GetItem(lpDIS->itemID, &tci);
pDC->SaveDC();
pDC->SetBkColor(RGB(0,0,0));
pDC->SetTextColor(RGB(255,255,255));
if (!lpDIS->itemState & ODS_SELECTED)
rc.OffsetRect(4,3);
else
{
pDC->FillSolidRect(&rc, RGB(0,0,0));
rc.OffsetRect(6,4);
}
pDC->TextOut(rc.left, rc.top, szTabText);
pDC->RestoreDC(-1);
}
Permalink: Code Library - Set the head backgroud color of CPropertyPage
Subcribe the update with Google Reader.
RSS feed for comments on this post · TrackBack URI
Leave a reply