i got my propertysheet and my propertypage colored in the way
i wanted, but the tab controller refuses to do so...
those charakters marked as # in the illustration above are still
colored in standard windows grey :-((
i could find a OnCtlColor function for CTabCtrl.. that's the way
i got the other widgets colored..
are there any ideas on how to get this part of my app 'dressed'
the way i like ?
It's been a while, but my recollection is that you need to handle
WM_ERASEBKGND in a subclass.
--
Jeff Partch [VC++ MVP]
hi all,
Relv
thanks in advance !
cheers
joerg
Hi
You have to set the TCS_OWNERDRAWFIXED style to the tab control and
overwrite DrawItem
Example
BOOL CMyTabControl::OnEraseBkgnd(CDC* pDC)
{
CRect rcClient;
GetClientRect(&rcClient);
pDC->FillSolidRect(rcClient, m_bkgColor);
// Bkg Color for your Tab Control
return TRUE;
}
void CMyTabControl::DrawItem(LPDRAWITEMSTRUCT lpDIS) // Drawing one
Tab
{
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->SetBkColor(m_bkgColor);
pDC->FillSolidRect(&lpDIS->rcItem, m_bkgColor);
if (lpDIS->itemState & ODS_SELECTED)
{
pDC->SetTextColor(RGB(0,0,255));
pDC->DrawText(szTabText, &lpDIS->rcItem , DT_CENTER | DT_VCENTER |
DT_SINGLELINE);
}
else
{
pDC->SetTextColor(RGB(0,0,0));
pDC->DrawText(szTabText, &lpDIS->rcItem , DT_CENTER | DT_BOTTOM |
DT_SINGLELINE);
}
}
Hope this wil help you
Pat
do i also have to overload the CPropertySheet Class
when using its GetTabControl() function ?
'cause at the moment GetTabControl() returns me CTabCtrl Objects
an not the expected CMyTabControl objects :-((
thanks in advance
cheers
joerg
"Patrick Brunmayr" <patrick....@gascad.at> schrieb im Newsbeitrag
news:#74vRBST...@TK2MSFTNGP12.phx.gbl...
got the tabs and there back working, but the textcolor changed also
and the tabs' titels can't be read.. it seems they're deleted when
colorize the background..
any ideas of how to get the tabs' title colored ?
TIA !!
cheers
joerg