Free Source Code and Program Tips
Set the head backgroud color of CPropertyPage
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);
}
| Print article | This entry was posted by support on October 18, 2007 at 9:35 pm, and is filed under General. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |