Click here to Skip to main content
11,410,750 members (64,599 online)
Click here to Skip to main content

Sizing TabControlBar

, 7 Feb 2000
Rate this:
Please Sign up or sign in to vote.
Creates a dockable and resizable control bar.
  • Download demo project - 46 Kb
  • Sample Image - Sizing_Tabctl.jpg

    <!-- Article Starts -->

    This article extends the article CSizingControlBar - a resizable control bar by Cristi Posea.
    Webmaster's note: the CSizingControlBar class used in this code is an earlier version; follow the link above for the latest one.


    The Control bar like in DevStudio, which has TabControls with different Views (like TreeViews) and it can be docked and resized.


    Add the following class to your project:

    • CSizingControlBar
    • CSizingTabCtrlBar

    Add a member variable to CMainFrame (in mainfrm.h):

    CSizingTabCtrlBar m_wndSTCBar;

    Create the bar in CMainFrame::OnCreate(). Then set bar styles, enable it to dock... like any control bar. Be sure to add IDW_PROP_BAR to the "resource.h" and to add the bitmap IDB_TABIMAGES to your resources.

    // SizingControlBar
    m_wndSTCBar.Create(this, CSize(200, 1), IDW_PROP_BAR);
    m_wndSTCBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
    DockControlBar(&m_wndSTCBar, AFX_IDW_DOCKBAR_LEFT);
    m_wndSTCBar.AddView("Database", RUNTIME_CLASS(CClassView));
    m_wndSTCBar.AddView("Files", RUNTIME_CLASS(CFileView));

    As you can see, the different views are added by calling

    m_wndSTCBar.AddView("Files", RUNTIME_CLASS(CFileView));

    Thats the only thing you have to do, to add a view!

    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) 

    To call a view from the Mainframe:

    CFileView* pView = (CFileView*)
    pView->UpdateView();	// or do anything else


    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    About the Author

    Dirk Clemens

    Germany Germany
    No Biography provided

    Comments and Discussions

    QuestionMainframe events gets disabled PinmemberD L Deepthi26-Apr-07 1:01 
    GeneralCode not maintained anymore PinmemberDirk Clemens25-Jan-05 6:41 
    GeneralDamm! Not Working Pinmemberdreucker_coder3-Jan-05 17:34 
    GeneralThe shorter way, please help fix Pinmemberpank00727-Nov-04 12:28 
    GeneralWinFrm2.cpp and bardock errors PinmemberFurries24-Nov-04 6:46 
    GeneralNot work with either vs6 Pinmemberpank00721-Nov-04 12:52 
    GeneralCommand message handling in views inside this bar Pinmemberatali21-Oct-04 7:18 
    GeneralRedraw the bar after adding a view Pinmemberatali21-Oct-04 7:11 
    GeneralSupport for top and multiline taps Pinmemberjaime_olivares8-Jul-04 15:33 
    GeneralBetter version Pinmemberjaime_olivares8-Jul-04 15:52 
    QuestionBugs? Pinmembermaydina24-Apr-04 4:51 
    GeneralProblem with CSizingTabCtrlBar by Dirk Clemens Pinmemberredsome25-Mar-04 15:43 
    GeneralProg crash by klick on X PinmemberLowFly18-Mar-04 6:04 
    GeneralMutch Better Layout Code PinmemberMOX10-Mar-04 8:28 
    GeneralRe: Mutch Better Layout Code PinmemberKybert9-Apr-04 12:47 
    GeneralRe: Mutch Better Layout Code PinsussAnonymous19-Apr-04 10:59 
    AnswerRe: Mutch Better Layout Code PinmemberThornets30-Jul-08 23:52 
    Generalissue when closing with floating bar Pinmemberavcode4-Mar-04 22:43 
    GeneralDocking - TOP , BOTTOM Pinmembersalil_ps20-Feb-04 21:39 
    D'Oh! | :doh: Is it possible to dock the window to the top or bottom of the frame
    GeneralProblems with Mouse Click Pinmembersalman29-Dec-03 21:04 
    Generalwheel mouse capture problem Pinmemberstevehaigh8-Nov-03 12:21 
    GeneralClosing CSizingControlBar PinsussD-MD31-Jul-03 11:48 
    GeneralRe: Closing CSizingControlBar Pinmemberxiaobin9-Aug-03 23:55 
    GeneralNot work well in 2003!! PinmemberYoyoboy31-Jul-03 3:56 
    GeneralRe: Not work well in 2003!! Pinmemberlqhwinner3-Jun-04 3:22 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    | Advertise | Privacy | Terms of Use | Mobile
    Web03 | 2.8.150414.5 | Last Updated 8 Feb 2000
    Article Copyright 2000 by Dirk Clemens
    Everything else Copyright © CodeProject, 1999-2015
    Layout: fixed | fluid