I’m using the following code to highlight a tab (in a class derived from CExtTabWnd):
virtual void OnTabWndDrawItem(
CDC & dc,
CRect & rcTabItemsArea,
LONG nItemIndex,
TAB_ITEM_INFO * pTii,
bool bTopLeft,
bool bHorz,
bool bSelected,
bool bCenteredText,
bool bGroupedMode,
bool bInGroupActive,
bool bInvertedVerticalMode,
const CRect & rcEntireItem,
CSize sizeTextMeasured,
CFont * pFont,
__EXT_MFC_SAFE_LPCTSTR sText,
CExtCmdIcon * pIcon
)
{
// Let’s put changed tabs in red.
if (m_pParent->FindChangedTab(nItemIndex) != m_pParent->m_changedTabs.end())
{
/* this code did not work at all
COLORREF prevcolor = dc.SetTextColor(RGB(255,0,0));
CExtTabWnd::OnTabWndDrawItem(dc, rcTabItemsArea, nItemIndex, pTii, bTopLeft,
bHorz, bSelected, bCenteredText, bGroupedMode, bInGroupActive, bInvertedVerticalMode,
rcEntireItem, sizeTextMeasured, pFont, sText, pIcon);
dc.SetTextColor(prevcolor);
*/
if( (pTii->GetItemStyle() & __ETWI_CENTERED_TEXT) != 0 )
bCenteredText = true;
PmBridge_GetPM()->PaintTabItem(
dc,
rcTabItemsArea,
bTopLeft,
bHorz,
bSelected,
bCenteredText,
bGroupedMode,
bInGroupActive,
bInvertedVerticalMode,
rcEntireItem,
sizeTextMeasured,
pFont,
sText,
pIcon,
this,
nItemIndex,
RGB(255,0,0));
}
else
CExtTabWnd::OnTabWndDrawItem(dc, rcTabItemsArea, nItemIndex, pTii, bTopLeft,
bHorz, bSelected, bCenteredText, bGroupedMode, bInGroupActive, bInvertedVerticalMode,
rcEntireItem, sizeTextMeasured, pFont, sText, pIcon);
}
It works fine when not using skins, but do not work with skins.
How can I get it to work with both?
One or more tabs can be flagged as "changed" and therfore getting a red text.