provided by: 
Originally published at Internet.com This article was contributed by Cristi Posea.
Features
Control bar like in DevStudio, that size both when docked and when floating.
The source code is free !
Easy to use: just derive your own control bar from CSizingControlBar and add your child controls.
Instructions
Derive a class from CSizingControlBar (you have an example in mybar.h and mybar.cpp).
Add a member variable to CMainFrame (in mainfrm.h). CMyBar m_wndMyBar;
Create the bar in CMainFrame::OnCreate(). Then set bar styles, enable it to dock... like any control bar. if (!m_wndMyBar.Create(this, CSize(200, 100), AFX_IDW_CONTROLBAR_FIRST + 32)) { TRACE0("Failed to create mybar\n"); return -1; // fail to create }
Override CMainFrame::RecalcLayout().
Note: use the base framewnd class member function, ie if you have an SDI application replace CMDIFrameWnd with CFrameWnd below. void CMainFrame::RecalcLayout(BOOL bNotify) { CMDIFrameWnd::RecalcLayout(bNotify); CMDIFrameWnd::RecalcLayout(bNotify); }
Because of RecalcLayout mechanism in MFC, I had to use several tricks to improve the look of control bar. One of them is the double call to RecalcLayout() for controlbar to stretch correctly. The other is that the height of the control bar is 4 pixel larger than its DockBar when docked vertically. So take care of OnSize() member function of your derived class. An example for a control bar with one child control is CMyBar, also included.
Download Source 8KB
The zip file contains the CSizingControlBar class, a sample class CMyBar derived from CSizingControlBar and the CMainFrame class from a MDI application which have a CMyBar control bar.
Author: Cristi Posea
Read article at Internet.com site