My second ToolBar when create sits directly underneath the standard ToolBar.
I want it to be by the side.
How do I do this?
Simon Pettman
Research Engineer
Goodmans Loudspeakers Ltd
[email protected]
Printable View
My second ToolBar when create sits directly underneath the standard ToolBar.
I want it to be by the side.
How do I do this?
Simon Pettman
Research Engineer
Goodmans Loudspeakers Ltd
[email protected]
There is no CBRS_NO_ALIGN
#define CBRS_NO_ALIGN 0X0000L do this in the stdafx.h and it's used everywhere
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
to
m_wndToolBar.EnableDocking ( CBRS_NO_ALIGN );
Then Float the tool bar and set it's position as needed
FloatControlBar(&m_wndToolBar,CPoint(200,200));
regards
Hans Wedemeyer
Try this function which I found on the MSDN and is also on this site.
As you can see it should be a member of your CMainFrame class.
void CMainFrame::DockControlBarLeftOf( CToolBar* RightBar, CToolBar* LeftBar )
{
CRect rect;
DWORD dw;
UINT n;
// get MFC to adjust the dimensions of all docked ToolBars
// so that GetWindowRect will be accurate
RecalcLayout();
LeftBar->GetWindowRect(&rect);
rect.OffsetRect(1,0);
dw = LeftBar->GetBarStyle();
n = 0;
n = (dw & CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n;
n = (dw & CBRS_ALIGN_BOTTOM && n==0) ? AFX_IDW_DOCKBAR_BOTTOM : n;
n = (dw & CBRS_ALIGN_LEFT && n==0) ? AFX_IDW_DOCKBAR_LEFT : n;
n = (dw & CBRS_ALIGN_RIGHT && n==0) ? AFX_IDW_DOCKBAR_RIGHT : n;
// When we take the default parameters on rect, DockControlBar will dock
// each Toolbar on a seperate line. By calculating a rectangle, we in effect
// are simulating a Toolbar being dragged to that location and docked.
DockControlBar(RightBar,n,&rect);
}