Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Ferdz B
|
Jul 23, 2007 - 1:47 AM
|
The "Improved alignment, measuring and background painting of the buttons in the menu bar " enhancement breaks dropdown painting of non-standard size (tall) toolbars.
To reproduce it use the Funnybars sample app:
1.) Add a new menu to contain a popup menu. For example IDR_MENU1
2.) Add a static function in MainFrm.cpp right above the OnCreate method
void AddDropDownButton(CExtToolControlBar * pTb, UINT nID) { INT nBtnIdx = pTb->CommandToIndex( nID ); ASSERT( nBtnIdx >= 0 ); CMenu mruMenu; VERIFY( mruMenu.LoadMenu( IDR_MENU1 ) ); VERIFY( pTb->SetButtonMenu(nBtnIdx, mruMenu.Detach() ) ); CExtBarButton * pTBB = pTb->GetButton(nBtnIdx); ASSERT_VALID( pTBB ); pTBB->SetSeparatedDropDown(); }
3.) Right after the setup of m_wndToolBarTruePlusText, use the AddDropDownButton as shown below
m_wndToolBarTruePlusText.InitContentExpandButton(); m_wndToolBarTrueHot.InitContentExpandButton(); AddDropDownButton(&m_wndToolBarTrue, ID_TRUE_FILE_OPEN); AddDropDownButton(&m_wndToolBarTruePlusText, ID_TRUE_FILE_OPEN);
4.) At runtime, when you click the dropdown arrow, the button is painted just half of button area!
|
|
Technical Support
|
Jul 24, 2007 - 7:43 AM
|
Thank you for reporting the bug. To fix it, please update the following method: void CExtPaintManagerOffice2003::PaintBarButtonCombinedArea(
CDC & dc,
CExtBarButton * pTBB,
LPARAM lParam // = 0L
)
{
ASSERT_VALID( (&dc) );
ASSERT( dc.GetSafeHdc() != NULL );
ASSERT_VALID( pTBB );
ASSERT_VALID( pTBB->GetBar() );
if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) <= 8 )
{
CExtPaintManagerXP::PaintBarButtonCombinedArea(
dc,
pTBB,
lParam
);
return;
}
CExtToolControlBar * pBar = pTBB->GetBar();
ASSERT_VALID( pBar );
bool bHorz = pBar->IsDockedVertically() ? false : true;
bool bMenuBar =
pBar->IsKindOf( RUNTIME_CLASS( CExtMenuControlBar ) )
? true
: false;
CRect rcTBB = pTBB->Rect();
CRect rcPaintGradient = rcTBB;
rcPaintGradient.DeflateRect( 1, 1 );
const INT nGradientHeight = 21;
rcPaintGradient.bottom = rcPaintGradient.top + nGradientHeight;
COLORREF clrTbbBkTop = GetColor( _2003CLR_TBB_BK_COMBINED_TOP, pTBB, lParam );
COLORREF clrTbbBkBottom = GetColor( _2003CLR_TBB_BK_COMBINED_BOTTOM, pTBB, lParam );
if( bHorz )
{
if( bMenuBar )
{
CRect rcBk( rcTBB );
rcBk.DeflateRect( 1, 1, 1, 0 );
dc.FillSolidRect(
&rcBk,
GetColor( XPCLR_3DFACE_NORMAL, pTBB, lParam )
);
CRect rcExclude( rcPaintGradient );
rcExclude.top = rcTBB.bottom - 1;
dc.ExcludeClipRect( &rcExclude );
stat_PaintGradientRect(
dc,
rcPaintGradient,
clrTbbBkBottom,
clrTbbBkTop,
true
);
dc.SelectClipRgn( NULL );
}
else
{
CRect rc = rcTBB;
rc.DeflateRect( 1, 1 );
stat_PaintGradientRect(
dc,
rc,
clrTbbBkBottom,
clrTbbBkTop,
true
);
}
}
else
{
stat_PaintGradientRect(
dc,
rcPaintGradient,
clrTbbBkBottom,
clrTbbBkTop,
true
);
if( rcTBB.bottom > rcPaintGradient.bottom )
{
CRect rcRest(
rcPaintGradient.left,
rcPaintGradient.bottom,
rcPaintGradient.right,
rcTBB.bottom
);
dc.FillSolidRect(
&rcRest,
clrTbbBkBottom
);
}
}
if( (! bHorz )
&& (! pTBB->IsKindOf( RUNTIME_CLASS(CExtBarColorButton) ) )
&& (! pTBB->GetSeparatedDropDown() )
)
{
COLORREF clrDkBorder = GetColor( XPCLR_MENU_BORDER, pTBB, lParam );
dc.Draw3dRect( pTBB->Rect(), clrDkBorder, clrDkBorder );
}
}
|
|