We are sorry for the delay with this reply. Thank you for reporting this issue. Please update the source code for the following two methods:
void CExtTabWnd::_GetTabWndFont(
CFont * pFont,
bool bSelected,
DWORD dwOrientation // = DWORD(-1) // default orientation
) const
{
ASSERT_VALID( this );
if( dwOrientation == DWORD(-1) )
dwOrientation = OrientationGet();
CExtPaintManager * pPM = PmBridge_GetPM();
ASSERT_VALID( pPM );
bool bBold =
( bSelected && SelectionBoldGet() )
? true
: false
;
CFont * pSrcFont = NULL;
if( dwOrientation == __ETWS_ORIENT_TOP
|| dwOrientation == __ETWS_ORIENT_BOTTOM
)
pSrcFont =
bBold
? (&pPM->m_FontBold)
: (&pPM->m_FontNormal)
;
else
if( GetTabWndStyle() & __ETWS_INVERT_VERT_FONT )
pSrcFont =
bBold
? (&pPM->m_FontBoldVertX)
: (&pPM->m_FontNormalVertX)
;
else
pSrcFont =
bBold
? (&pPM->m_FontBoldVert)
: (&pPM->m_FontNormalVert)
;
ASSERT( pSrcFont != NULL );
ASSERT( pSrcFont->GetSafeHandle() != NULL );
LOGFONT _lf;
::memset( &_lf, 0, sizeof(LOGFONT) );
pSrcFont->GetLogFont( &_lf );
if( pFont->GetSafeHandle() != NULL )
pFont->DeleteObject();
pFont->CreateFontIndirect( &_lf );
}
void CExtPaintManager::stat_PaintTabItemImpl(
CDC & dc,
CRect & rcTabItemsArea,
bool bTopLeft,
bool bHorz,
bool bSelected,
bool bEnabled,
bool bCenteredText,
bool bGroupedMode,
bool bInGroupActive,
bool bInvertedVerticalMode,
bool bDrawIcon,
const CRect & rcEntireItem,
CSize sizeTextMeasured,
CFont * pFont,
__EXT_MFC_SAFE_LPCTSTR sText,
CExtCmdIcon * pIcon,
CExtCmdIcon * pIconTabItemCloseButton,
INT nPaintStateITICB,
CRect & rcTabItemCloseButton,
COLORREF clrText,
COLORREF clrTabBk,
COLORREF clrTabBorderLT,
COLORREF clrTabBorderRB,
COLORREF clrTabSeparator,
bool bEnableEndEllipsis, // = true
CObject * pHelperSrc // = NULL
)
{
ASSERT( dc.GetSafeHdc() != NULL );
pHelperSrc;
rcTabItemsArea;
sizeTextMeasured;
bInGroupActive;
CRect rcItem( rcEntireItem );
CRect rcTabSel( rcItem );
if( bGroupedMode )
{
CRect rcTabMargin( rcItem );
rcTabMargin.InflateRect(
0,
0,
bHorz ? 1 : 0,
bHorz ? 0 : 1
);
rcTabMargin.InflateRect(
bHorz ? 0 : 2,
bHorz ? 2 : 0
);
if( clrTabBk != COLORREF(-1L) )
dc.FillSolidRect(
&rcTabMargin,
clrTabBk
);
if( clrTabBorderLT != COLORREF(-1L)
&& clrTabBorderRB != COLORREF(-1L)
)
dc.Draw3dRect(
rcTabMargin,
clrTabBorderLT,
clrTabBorderRB
);
} // if( bGroupedMode )
else
{
if( bSelected )
{
rcTabSel.InflateRect(
bHorz ? __EXTTAB_SEPARATOR_DX : 0,
bHorz ? 0 : __EXTTAB_SEPARATOR_DY,
0,
0
);
CRect rcSetMargins(
( (!bHorz) && (!bTopLeft) ) ? 1 : 0,
( bHorz && (!bTopLeft) ) ? 1 : 0,
( (!bHorz) && bTopLeft ) ? 1 : 0,
( bHorz && bTopLeft ) ? 1 : 0
);
rcTabSel.InflateRect(
rcSetMargins.left,
rcSetMargins.top,
rcSetMargins.right,
rcSetMargins.bottom
);
if( clrTabBorderLT != COLORREF(-1L)
&& clrTabBorderRB != COLORREF(-1L)
)
{
CPen penTabBorderLT(PS_SOLID,1,clrTabBorderLT);
CPen penTabBorderRB(PS_SOLID,1,clrTabBorderRB);
if( bHorz )
{
if( bTopLeft )
{
CPen * pOldPen = dc.SelectObject( &penTabBorderLT );
dc.MoveTo( rcTabSel.left, rcTabSel.bottom );
dc.LineTo( rcTabSel.left, rcTabSel.top );
dc.LineTo( rcTabSel.right, rcTabSel.top );
dc.SelectObject( &penTabBorderRB );
dc.MoveTo( rcTabSel.right-1, rcTabSel.top );
dc.LineTo( rcTabSel.right-1, rcTabSel.bottom-1 );
dc.SelectObject( pOldPen );
}
else
{
CPen * pOldPen = dc.SelectObject( &penTabBorderLT );
dc.MoveTo( rcTabSel.left, rcTabSel.top-1 );
dc.LineTo( rcTabSel.left, rcTabSel.bottom );
dc.SelectObject( &penTabBorderRB );
dc.MoveTo( rcTabSel.left, rcTabSel.bottom-1 );
dc.LineTo( rcTabSel.right-1, rcTabSel.bottom-1 );
dc.LineTo( rcTabSel.right-1, rcTabSel.top-1 );
dc.SelectObject( pOldPen );
}
}
else
{
if( bTopLeft )
{
CPen * pOldPen = dc.SelectObject( &penTabBorderLT );
dc.MoveTo( rcTabSel.right-1, rcTabSel.top );
dc.LineTo( rcTabSel.left, rcTabSel.top );
dc.LineTo( rcTabSel.left, rcTabSel.bottom );
dc.SelectObject( &penTabBorderRB );
dc.MoveTo( rcTabSel.left, rcTabSel.bottom-1 );
dc.LineTo( rcTabSel.right-1, rcTabSel.bottom-1 );
dc.SelectObject( pOldPen );
}
else
{
CPen * pOldPen = dc.SelectObject( &penTabBorderLT );
dc.MoveTo( rcTabSel.left, rcTabSel.top );
dc.LineTo( rcTabSel.right, rcTabSel.top );
dc.SelectObject( &penTabBorderRB );
dc.MoveTo( rcTabSel.right-1, rcTabSel.top );
dc.LineTo( rcTabSel.right-1, rcTabSel.bottom-1 );
dc.LineTo( rcTabSel.left, rcTabSel.bottom-1 );
dc.SelectObject( pOldPen );
}
}
}
rcTabSel.DeflateRect(
(rcSetMargins.left == 0) ? 1 : 0,
(rcSetMargins.top == 0) ? 1 : 0,
(rcSetMargins.right == 0) ? 1 : 0,
(rcSetMargins.bottom == 0) ? 1 : 0
);
if( clrTabBk != COLORREF(-1L) )
dc.FillSolidRect( &rcTabSel, clrTabBk );
} // if( bSelected )
else
{
CRect rcSeparator( rcItem );
if( bHorz )
{
rcSeparator.left = rcSeparator.right - 1;
rcSeparator.DeflateRect( 0, __EXTTAB_SEPARATOR_GAP_HORZ );
}
else
{
rcSeparator.top = rcSeparator.bottom - 1;
rcSeparator.DeflateRect( __EXTTAB_SEPARATOR_GAP_VERT, 0 );
}
if( clrTabSeparator != COLORREF(-1L) )
dc.FillSolidRect( &rcSeparator, clrTabSeparator );
} // else from if( bSelected )
} // else from if( bGroupedMode )
rcItem.DeflateRect(
bHorz ? __EXTTAB_MARGIN_BORDER_HX : __EXTTAB_MARGIN_BORDER_VX,
bHorz ? __EXTTAB_MARGIN_BORDER_HY : __EXTTAB_MARGIN_BORDER_VY
);
CSize _sizeIcon( 0, 0 );
if( bDrawIcon )
{
_sizeIcon = pIcon->GetSize();
ASSERT( _sizeIcon.cx > 0 && _sizeIcon.cy > 0 );
} // if( bDrawIcon )
CExtSafeString sItemText( (sText == NULL) ? _T("") : sText );
// IMPORTANT: the rcText calculation fixed by Genka
CRect rcText(
rcItem.left
+ ( bHorz
? (_sizeIcon.cx +
((_sizeIcon.cx > 0) ? __EXTTAB_MARGIN_ICON2TEXT_X : 0)
)
: 0
),
rcItem.top
+ ( bHorz
? 0
: (_sizeIcon.cy +
((_sizeIcon.cy > 0) ? __EXTTAB_MARGIN_ICON2TEXT_Y : 0)
)
),
rcItem.right,
rcItem.bottom
);
if( !bHorz )
{
if( pIconTabItemCloseButton != NULL )
rcText.bottom = min( rcText.bottom, rcTabItemCloseButton.top );
int nWidth0 = rcText.Width();
int nWidth1 = rcItem.Width() + __EXTTAB_MARGIN_ICON2TEXT_X*2;
if( nWidth1 > nWidth0 )
{
if( bInvertedVerticalMode )
{
//rcText.right -= __EXTTAB_MARGIN_ICON2TEXT_X;
rcText.left = rcText.right - nWidth1;
} // if( bInvertedVerticalMode )
else
{
//rcText.left += __EXTTAB_MARGIN_ICON2TEXT_X;
rcText.right = rcText.left + nWidth1;
} // else from if( bInvertedVerticalMode )
} // if( nWidth1 > nWidth0 )
} // if( !bHorz )
else
{
if( pIconTabItemCloseButton != NULL )
rcText.right = min( rcText.right, rcTabItemCloseButton.left );
}
bool bDrawText = ( rcText.Width() > 0 && rcText.Height() > 0 ) ? true : false;
if( bDrawIcon )
{
INT nIconAlignment = __ALIGN_VERT_TOP;
if( (!bDrawText) && !( bGroupedMode && (!bInGroupActive) ) )
nIconAlignment |= __ALIGN_HORIZ_CENTER;
if( (bHorz && rcItem.Width() >= _sizeIcon.cx )
|| (!bHorz && rcItem.Height() >= _sizeIcon.cy)
)
{
g_PaintManager->PaintIcon(
dc,
bHorz,
pIcon,
rcItem,
false,
bEnabled,
false,
nIconAlignment
);
}
} // if( bDrawIcon )
if( bDrawText )
{ // if we have sense to paint text on tab item
ASSERT( pFont != NULL );
ASSERT( pFont->GetSafeHandle() != NULL );
COLORREF clrOldText = dc.SetTextColor( clrText );
INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
CFont * pOldFont = dc.SelectObject( pFont );
if( ! bHorz )
{
if( bCenteredText )
{
UINT nOldTA = dc.SetTextAlign(
TA_CENTER | TA_BASELINE
);
rcText.OffsetRect(
bInvertedVerticalMode
? sizeTextMeasured.cy/2
: - sizeTextMeasured.cy/2
,
0
);
CPoint ptCenter = rcText.CenterPoint();
dc.ExtTextOut(
ptCenter.x,
ptCenter.y,
ETO_CLIPPED,
&rcText,
sItemText,
sItemText.GetLength(),
NULL
);
dc.SetTextAlign( nOldTA );
} // if( bCenteredText )
else
{
UINT nOldTA = dc.SetTextAlign(
TA_TOP | TA_BASELINE
);
rcText.OffsetRect(
bInvertedVerticalMode
? sizeTextMeasured.cy/2
: - sizeTextMeasured.cy/2
,
0
);
CPoint ptCenter = rcText.CenterPoint();
if( bInvertedVerticalMode )
ptCenter.y =
rcText.bottom - 4
- (rcText.Height() - sizeTextMeasured.cx)
;
else
ptCenter.y =
rcText.top + 4
;
dc.ExtTextOut(
ptCenter.x,
ptCenter.y,
ETO_CLIPPED,
&rcText,
sItemText,
sItemText.GetLength(),
NULL
);
dc.SetTextAlign( nOldTA );
} // else from if( bCenteredText )
} // if( ! bHorz )
else
{
UINT nFormat =
DT_SINGLELINE
| DT_VCENTER
| ( bEnableEndEllipsis ? (DT_END_ELLIPSIS) : 0 )
;
INT nTextLen = sItemText.GetLength();
if( bCenteredText )
{
CRect rcMeasure( 0, 0, 0, 0 );
dc.DrawText(
LPCTSTR(sItemText),
nTextLen,
rcMeasure,
DT_SINGLELINE|DT_LEFT|DT_TOP|DT_CALCRECT
);
INT nMeasuredWidth = rcMeasure.Width();
INT nTextAreaWidth = rcText.Width();
if( nTextAreaWidth < nMeasuredWidth )
bCenteredText = false;
}
if( bCenteredText )
nFormat |= DT_CENTER;
else
nFormat |= DT_LEFT;
dc.DrawText(
LPCTSTR(sItemText),
nTextLen,
rcText,
nFormat
);
} // else from if( ! bHorz )
dc.SelectObject( pOldFont );
dc.SetBkMode( nOldBkMode );
dc.SetTextColor( clrOldText );
} // if we have sense to paint text on tab item
if( pIconTabItemCloseButton != NULL )
{
ASSERT( ! pIconTabItemCloseButton->IsEmpty() );
if( dc.RectVisible( &rcTabItemCloseButton ) )
pIconTabItemCloseButton->Paint(
g_PaintManager.GetPM(),
dc.m_hDC,
rcTabItemCloseButton,
(CExtCmdIcon::e_paint_type_t)nPaintStateITICB
);
} // if( pIconTabItemCloseButton != NULL )
}