Solved

Dock ToolBar.

Posted on 2004-04-30
4
658 Views
Last Modified: 2013-11-20
How do I dock 2 toolbars and align them horizontally. I tried it but one of the tool bar is always shifted down to the second line.

Thanks.
0
Comment
Question by:pcssecure
  • 3
4 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 500 total points
ID: 10958627
Use this function..

void CMainFrame::DockControlBarLeftOf(CToolBar* Bar,CToolBar* LeftOf)
{
      CRect rect;
      DWORD dw;
      UINT n;

      // get MFC to adjust the dimensions of all docked ToolBars
      // so that GetWindowRect will be accurate
      RecalcLayout();
      LeftOf->GetWindowRect(&rect);
      rect.OffsetRect(1,0);
      dw=LeftOf->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(Bar,n,&rect);
}



And call this function from "CMainFrame::OnCreate", like this
DockControlBarLeftOf(&m_firstToolBar,&m_secondToolBar);

Good Luck
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 10984938
Hope your problem has solved..
:)
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 10995317
Is this code working?

Waiting for your reply
Rosh :)
0
 

Author Comment

by:pcssecure
ID: 11001414
Yes it works.
Thanks a lot. Sorry I forgot about this.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.NET how to use the Vertical ScrollBar 5 103
sum28 challenge 31 112
either24  challenge 19 97
Execute multiple curl cmds with sleep and send output to file 10 97
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question