Click here to Skip to main content
12,694,842 members (32,586 online)
Click here to Skip to main content
Add your own
alternative version


91 bookmarked

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

    You may also be interested in...


    Comments and Discussions

    GeneralViews update problem solved Pin
    FretBoardKnowledge18-Dec-02 15:15
    memberFretBoardKnowledge18-Dec-02 15:15 
    GeneralRe: Views update problem solved Pin
    Philip Patrick31-Mar-03 9:15
    memberPhilip Patrick31-Mar-03 9:15 
    GeneralRe: Views update problem solved Pin
    andyvinc24-Apr-04 5:35
    memberandyvinc24-Apr-04 5:35 
    Questionhow to merge two floating dialogbar into one floating tabbed dialogbar? Pin
    YU_Matrix27-Nov-02 21:59
    memberYU_Matrix27-Nov-02 21:59 
    Questionhelp, tell me what is IDW_PROP_BAR ?? Pin
    hongky17-Nov-02 20:03
    memberhongky17-Nov-02 20:03 
    AnswerRe: help, tell me what is IDW_PROP_BAR ?? Pin
    WREY21-Jun-03 14:53
    memberWREY21-Jun-03 14:53 
    GeneralBugfix: Defect border while enlarging Pin
    Tomer Shalev12-Aug-02 22:06
    sussTomer Shalev12-Aug-02 22:06 
    GeneralIt does Not work...Help me.... Pin
    ParkSK30-Jul-02 23:39
    sussParkSK30-Jul-02 23:39 
    GeneralRe: It does Not work...Help me.... Pin
    Jawid18-Sep-02 13:07
    memberJawid18-Sep-02 13:07 
    GeneralThank you very much..It works well !! Pin
    DevPark5-Nov-03 19:01
    memberDevPark5-Nov-03 19:01 
    GeneralRe: It does Not work...Help me.... Pin
    gremyus11-Feb-04 8:57
    membergremyus11-Feb-04 8:57 
    GeneralRe: It does Not work...Help me.... Pin
    sirius yang20-Oct-04 19:14
    membersirius yang20-Oct-04 19:14 
    Questionwhy onec i created it ,my listview will not work? Pin
    xsword6-May-02 1:36
    memberxsword6-May-02 1:36 
    QuestionRedrawing the client area? Pin
    Anonymous13-Apr-02 7:37
    memberAnonymous13-Apr-02 7:37 
    AnswerRe: Redrawing the client area? Pin
    Anonymous16-May-02 7:04
    memberAnonymous16-May-02 7:04 
    GeneralRe: Redrawing the client area? Pin
    DanPetitt17-Feb-03 11:56
    memberDanPetitt17-Feb-03 11:56 
    GeneralRe: Redrawing the client area? Pin
    DanPetitt17-Feb-03 12:07
    memberDanPetitt17-Feb-03 12:07 
    GeneralRe: Redrawing the client area? Pin
    uTMan12-Nov-03 9:28
    memberuTMan12-Nov-03 9:28 
    GeneralI can't run it. It dumped failed info when creat CSizingControlBar Pin
    Crob28-Feb-02 16:15
    memberCrob28-Feb-02 16:15 
    GeneralRe: I can't run it. It dumped failed info when creat CSizingControlBar Pin
    Anonymous6-Mar-02 13:41
    memberAnonymous6-Mar-02 13:41 
    GeneralSizing Tab Control Bar Pin
    carena10-Jan-02 23:33
    membercarena10-Jan-02 23:33 
    GeneralRe: Sizing Tab Control Bar Pin
    Anonymous22-May-02 8:19
    memberAnonymous22-May-02 8:19 
    GeneralRe: Sizing Tab Control Bar Pin
    zoocmic2-Jul-02 22:50
    memberzoocmic2-Jul-02 22:50 
    GeneralRe: Sizing Tab Control Bar (lost control) Pin
    Eugene Pankov24-Jul-02 4:55
    memberEugene Pankov24-Jul-02 4:55 
    Generalslow redraw when docked under NT Pin
    thotho26-Nov-01 1:12
    memberthotho26-Nov-01 1:12 
    GeneralRemove a view Pin
    Flavio Vanderson23-Nov-01 4:16
    memberFlavio Vanderson23-Nov-01 4:16 
    GeneralCanging Labeltext of Tabs while Resizing Pin
    Joerg Tiedemann13-Nov-01 23:45
    memberJoerg Tiedemann13-Nov-01 23:45 
    GeneralProblem by closing ControlBar Pin
    Holger Bach25-Oct-01 22:28
    memberHolger Bach25-Oct-01 22:28 
    GeneralRe: Problem by closing ControlBar Pin
    Neno29-Oct-01 0:17
    memberNeno29-Oct-01 0:17 
    GeneralRe: Problem by closing ControlBar Pin
    Nenad29-Oct-01 0:28
    memberNenad29-Oct-01 0:28 
    QuestionStart with no default document ?? Pin
    北極熊23-Oct-01 21:26
    member北極熊23-Oct-01 21:26 
    GeneralProblem with new ver CSizingControlBar and AddView() Pin
    Neno19-Oct-01 4:48
    memberNeno19-Oct-01 4:48 
    QuestionX-button problem? Pin
    Neno18-Oct-01 23:22
    memberNeno18-Oct-01 23:22 
    QuestionHow to create workspace Window? Pin
    Radhakrishnan R.25-Sep-01 0:52
    memberRadhakrishnan R.25-Sep-01 0:52 
    GeneralAdd a ListView Pin
    FranzKlein18-Jun-01 0:27
    memberFranzKlein18-Jun-01 0:27 
    GeneralRe: Add a ListView Pin
    Park KeunHyun16-Sep-01 18:29
    memberPark KeunHyun16-Sep-01 18:29 
    GeneralDagbog Pin
    Anonymous16-Mar-01 23:16
    memberAnonymous16-Mar-01 23:16 
    GeneralProblems with Visual Studio 6 Pin
    Craig Spry12-Oct-00 14:00
    sussCraig Spry12-Oct-00 14:00 
    GeneralRe: Problems with Visual Studio 6 Pin
    Rich McDonald13-Oct-00 14:23
    sussRich McDonald13-Oct-00 14:23 
    GeneralRe: Problems with Visual Studio 6 Pin
    Serginho15-Jul-02 22:22
    sussSerginho15-Jul-02 22:22 
    Generalno ENTER, no ESCAPE Messages in TreeView Pin
    Thomas Barthel28-Aug-00 11:05
    sussThomas Barthel28-Aug-00 11:05 
    GeneralRe: no ENTER, no ESCAPE Messages in TreeView Pin
    SureshBalivada31-Jul-01 10:56
    memberSureshBalivada31-Jul-01 10:56 
    GeneralProblem in AddView(....) Pin
    Sanjeev6-Aug-00 19:50
    sussSanjeev6-Aug-00 19:50 
    GeneralRe: Problem in AddView(....) Pin
    Sanjay Bora15-Aug-00 17:00
    sussSanjay Bora15-Aug-00 17:00 
    QuestionHow can we do this............... Pin
    Sanjeev2-Aug-00 22:22
    sussSanjeev2-Aug-00 22:22 
    GeneralSorry, no more maintainance! Pin
    Dirk Clemens25-Jul-00 2:58
    sussDirk Clemens25-Jul-00 2:58 
    GeneralUsing sample with CListView derived view .. Pin
    Dave Stanley24-Jul-00 14:59
    sussDave Stanley24-Jul-00 14:59 
    GeneralRe: Using sample with CListView derived view .. Pin
    Anonymous1-May-01 12:47
    memberAnonymous1-May-01 12:47 
    QuestionHow can i do this... Pin
    webguy11-Jul-00 12:51
    susswebguy11-Jul-00 12:51 
    Generalproblem --> Z order Pin
    DC13-Mar-00 3:36
    sussDC13-Mar-00 3:36 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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
    Web02 | 2.8.170118.1 | Last Updated 8 Feb 2000
    Article Copyright 2000 by Dirk Clemens
    Everything else Copyright © CodeProject, 1999-2017
    Layout: fixed | fluid