Click here to Skip to main content
11,437,978 members (43,078 online)
Click here to Skip to main content

Collapsible, resizable and dockable XP style control bar

, 22 Sep 2003
Rate this:
Please Sign up or sign in to vote.
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

Share

About the Author

Nicolas Gazelle
Web Developer
Monaco Monaco
No Biography provided

Comments and Discussions

 
Generaldoes not link Pin
cilu7-Feb-06 4:01
membercilu7-Feb-06 4:01 
QuestionHow to create Panel dynamic? Pin
closetome24-Dec-05 23:09
memberclosetome24-Dec-05 23:09 
QuestionResize while docked? Pin
Harald Karner12-Feb-04 23:08
sussHarald Karner12-Feb-04 23:08 
GeneralXP Colors of your bars Pin
Michael A. Rusakov30-Sep-03 3:41
memberMichael A. Rusakov30-Sep-03 3:41 
GeneralRe: XP Colors of your bars Pin
Nguyen Huu Hoa1-Oct-03 21:24
memberNguyen Huu Hoa1-Oct-03 21:24 
GeneralRe: XP Colors of your bars Pin
Michael A. Rusakov3-Oct-03 3:43
memberMichael A. Rusakov3-Oct-03 3:43 
Generalscrolling Pin
Bob Flynn23-Sep-03 22:57
memberBob Flynn23-Sep-03 22:57 
GeneralRe: scrolling Pin
andrewtruckle19-Jan-06 0:26
memberandrewtruckle19-Jan-06 0:26 
GeneralRe: scrolling Pin
Bob Flynn19-Jan-06 1:30
memberBob Flynn19-Jan-06 1:30 
GeneralRe: scrolling Pin
andrewtruckle19-Jan-06 1:34
memberandrewtruckle19-Jan-06 1:34 
GeneralDoesn't work Pin
Brigg Thorp23-Sep-03 2:53
memberBrigg Thorp23-Sep-03 2:53 
GeneralRe: Doesn't work Pin
Nicolas Gazelle23-Sep-03 3:01
memberNicolas Gazelle23-Sep-03 3:01 
GeneralRe: Doesn't work Pin
Ravi Bhavnani23-Sep-03 3:49
memberRavi Bhavnani23-Sep-03 3:49 
GeneralRe: Doesn't work Pin
Brigg Thorp23-Sep-03 7:00
memberBrigg Thorp23-Sep-03 7:00 
GeneralRe: Doesn't work Pin
Nicolas Gazelle23-Sep-03 7:02
memberNicolas Gazelle23-Sep-03 7:02 
GeneralRe: Doesn't work Pin
Stlan23-Sep-03 4:37
memberStlan23-Sep-03 4:37 
GeneralRe: Doesn't work Pin
Nicolas Gazelle23-Sep-03 4:43
memberNicolas Gazelle23-Sep-03 4:43 
GeneralRe: Doesn't work Pin
Sean O'Brien30-Sep-03 11:07
memberSean O'Brien30-Sep-03 11:07 
I would add some double buffer code to the control to prevent the flickering, but otherwise it looks great.
GeneralPermissions Pin
Derek Lakin22-Sep-03 22:38
memberDerek Lakin22-Sep-03 22:38 
GeneralRe: Permissions Pin
Nicolas Gazelle23-Sep-03 0:40
memberNicolas Gazelle23-Sep-03 0:40 
GeneralRe: Permissions Pin
Derek Lakin23-Sep-03 1:14
memberDerek Lakin23-Sep-03 1:14 
GeneralRe: Permissions Pin
Paul Selormey23-Sep-03 6:24
memberPaul Selormey23-Sep-03 6:24 
GeneralRe: Permissions Pin
Derek Lakin23-Sep-03 10:34
memberDerek Lakin23-Sep-03 10:34 
GeneralRe: Permissions Pin
Jim Crafton23-Sep-03 7:32
memberJim Crafton23-Sep-03 7:32 
GeneralRe: Permissions Pin
Derek Lakin23-Sep-03 10:32
memberDerek Lakin23-Sep-03 10:32 
GeneralRe: Permissions Pin
Jim Crafton23-Sep-03 12:26
memberJim Crafton23-Sep-03 12:26 
GeneralRe: Permissions Pin
CodeCool23-Sep-03 16:21
memberCodeCool23-Sep-03 16:21 

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
Web04 | 2.8.150506.1 | Last Updated 23 Sep 2003
Article Copyright 2003 by Nicolas Gazelle
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid