Click here to Skip to main content
15,860,972 members
Articles / Desktop Programming / MFC
Article

Collapsible, resizable and dockable XP style control bar

Rate me:
Please Sign up or sign in to vote.
3.38/5 (25 votes)
22 Sep 2003 195.5K   6.6K   89   27
Collapsible, resizable and dockable XP style control bar

Introduction

This class can be used to create a collapsible, resizable and dockable XP style control bar with very few lines of code.

The following files must be added to your project.

  • CollapsiblePanel.h
  • CollapsiblePanel.cpp

Resources

  • An empty dialog to define the initial control bar size.
  • A bitmap image for the logo of the button (if required).
  • A bitmap image for the expand icon of the button.
  • A dialog that will be displayed by the collapsible button.

Sample code

In your CMainFrame header file, define a variable of the type CCollapsiblePanel :

CCollapsiblePanel m_wndCollapsiblePanel;

In the CMainFrame::OnCreate() method, create the CDialog corresponding to the panels of the collapsible button :

CDialog* m_wndView1 = new CDialogButton1();

Set the Collapsible control bar (dockable, color and bitmaps.) :

m_wndCollapsiblePanel.CreateTheContainer(this, IDD_PANEL, true);
m_wndCollapsiblePanel.SetTheBkColor(RGB(100, 149, 237)); 
//m_wndCollapsiblePanel.SetDefaultSystemColor();
m_wndCollapsiblePanel.SetExpandBitmap(IDB_BITMAP_EXPAND);

Indicate if the program uses a toolbar or a status bar.

m_wndCollapsiblePanel.SetTheControlBar(&m_wndToolBar, &m_wndStatusBar);

Finally append the buttons.

m_wndCollapsiblePanel.AppendButton("Text Button 1", 
  IDB_BITMAP_DW, m_wndView1, IDD_DIALOG_BUTTON1);
m_wndCollapsiblePanel.AppendButton("Text Button 2", IDB_BITMAP_FW, 
  m_wndView2, IDD_DIALOG_BUTTON2);
m_wndCollapsiblePanel.AppendButton("text Button 3", NULL, NULL, NULL);

License

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


Written By
Web Developer
Monaco Monaco
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Generaldoes not link Pin
Marius Bancila7-Feb-06 3:01
professionalMarius Bancila7-Feb-06 3:01 
QuestionHow to create Panel dynamic? Pin
closetome24-Dec-05 22:09
closetome24-Dec-05 22:09 
QuestionResize while docked? Pin
Harald Karner12-Feb-04 22:08
sussHarald Karner12-Feb-04 22:08 
GeneralXP Colors of your bars Pin
Michael Rusakow30-Sep-03 2:41
Michael Rusakow30-Sep-03 2:41 
GeneralRe: XP Colors of your bars Pin
Nguyen Huu Hoa1-Oct-03 20:24
Nguyen Huu Hoa1-Oct-03 20:24 
GeneralRe: XP Colors of your bars Pin
Michael Rusakow3-Oct-03 2:43
Michael Rusakow3-Oct-03 2:43 
Generalscrolling Pin
Bob Flynn23-Sep-03 21:57
Bob Flynn23-Sep-03 21:57 
GeneralRe: scrolling Pin
andrewtruckle18-Jan-06 23:26
andrewtruckle18-Jan-06 23:26 
GeneralRe: scrolling Pin
Bob Flynn19-Jan-06 0:30
Bob Flynn19-Jan-06 0:30 
GeneralRe: scrolling Pin
andrewtruckle19-Jan-06 0:34
andrewtruckle19-Jan-06 0:34 
GeneralDoesn't work Pin
Brigg Thorp23-Sep-03 1:53
Brigg Thorp23-Sep-03 1:53 
GeneralRe: Doesn't work Pin
Nicolas Gazelle23-Sep-03 2:01
Nicolas Gazelle23-Sep-03 2:01 
GeneralRe: Doesn't work Pin
Ravi Bhavnani23-Sep-03 2:49
professionalRavi Bhavnani23-Sep-03 2:49 
GeneralRe: Doesn't work Pin
Brigg Thorp23-Sep-03 6:00
Brigg Thorp23-Sep-03 6:00 
GeneralRe: Doesn't work Pin
Nicolas Gazelle23-Sep-03 6:02
Nicolas Gazelle23-Sep-03 6:02 
GeneralRe: Doesn't work Pin
Stlan23-Sep-03 3:37
Stlan23-Sep-03 3:37 
GeneralRe: Doesn't work Pin
Nicolas Gazelle23-Sep-03 3:43
Nicolas Gazelle23-Sep-03 3:43 
GeneralRe: Doesn't work Pin
Sean O'Brien30-Sep-03 10:07
Sean O'Brien30-Sep-03 10:07 
GeneralPermissions Pin
Derek Lakin22-Sep-03 21:38
Derek Lakin22-Sep-03 21:38 
GeneralRe: Permissions Pin
Nicolas Gazelle22-Sep-03 23:40
Nicolas Gazelle22-Sep-03 23:40 
GeneralRe: Permissions Pin
Derek Lakin23-Sep-03 0:14
Derek Lakin23-Sep-03 0:14 
GeneralRe: Permissions Pin
Paul Selormey23-Sep-03 5:24
Paul Selormey23-Sep-03 5:24 
Derek Lakin wrote:
You have made use of icons/images of mine without permission that have previously been made available for personal use only. Given the open source nature of your code then please you will you add a specific credit for the artwork and refer to my my website[^].

Was there any license statement attached to your post to that effect or you just want to throw your weight about?

Best regards,
Paul.

Jesus Christ is LOVE! Please tell somebody.
GeneralRe: Permissions Pin
Derek Lakin23-Sep-03 9:34
Derek Lakin23-Sep-03 9:34 
GeneralRe: Permissions Pin
Jim Crafton23-Sep-03 6:32
Jim Crafton23-Sep-03 6:32 
GeneralRe: Permissions Pin
Derek Lakin23-Sep-03 9:32
Derek Lakin23-Sep-03 9:32 

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.