|
|
|
|
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 |
|
Matthew Fraser
|
Apr 26, 2007 - 11:12 PM
|
Hi!!
How to arrange toolbars attached in a MDI child view ? I got the following codes. It doesn’t work.
CRect rectAlreadyDockedBar; m_wndToolBarZoom.GetWindowRect(&rectAlreadyDockedBar); rectAlreadyDockedBar.OffsetRect(1, 0); DockControlBar(&m_wndToolBarZoom, AFX_IDW_DOCKBAR_TOP); //DockControlBar(&m_wndToolBarZoom, AFX_IDW_DOCKBAR_TOP, &rectAlreadyDockedBar);
Thanks.
|
|
Suhai Gyorgy
|
Apr 27, 2007 - 2:15 AM
|
I’m guessing you have 2 toolbars that you’d like to dock side by side on top. But in your code you are only mentioning one toolbar.
This one works for me: CRect wrAlreadyDockedBar, wrMainWindow;
GetWindowRect( &wrMainWindow );
DockControlBar( &m_wndToolBar1, AFX_IDW_DOCKBAR_TOP );
ShowControlBar( &m_wndToolBar1, true, true );
RecalcLayout();
int iOccupiedWidth = m_wndToolBar1.CalcFixedLayout( FALSE, TRUE ).cx;
int iOtherWidth = m_wndToolBar2.CalcFixedLayout( FALSE, TRUE ).cx;
if ( iOccupiedWidth + iOtherWidth < wrMainWindow.Width() )
{
m_wndToolBar1.GetWindowRect( &wrAlreadyDockedBar );
wrAlreadyDockedBar.OffsetRect( 1, 0 );
DockControlBar( &m_wndToolBar2, AFX_IDW_DOCKBAR_TOP, &wrAlreadyDockedBar );
}
else
{
DockControlBar( &m_wndToolBar2 );
}
ShowControlBar( &m_wndToolBar2, true, true );
RecalcLayout();
|
|