Collapsible, Resizable, and Dockable XP-Style Control Bar

Environment: VC++

Introduction

This class, to be inserted into your project, only needs a few functions to be set up.

Files Needed

  • 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 expanded 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));
    

    or

    m_wndCollapsiblePanel.SetDefaultSystemColor();
    m_wndCollapsiblePanel.SetExpandBitmap(IDB_BITMAP_EXPAND);
    
  • Indicate whether 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);
    

Downloads

Download demo project - 251 Kb


Comments

  • Ooooooo

    Posted by xrlc on 09/10/2004 04:56pm

    This control is a hmmm (alpha, beta, gama, delta) ... omega version!

    Reply
  • HHmmmmmmm

    Posted by Legacy on 09/24/2003 12:00am

    Originally posted by: Oni

    Nice example. However when the dialog is floating and you click on an drop-down, the whole dialog moves across and down by 1 or more pixels...

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

  • On-demand Event Event Date: July 22, 2014 In this WhatWorks analysis, John Pescatore examines a use case where end users had local administrative rights on their PCs and it had gotten out of hand for this Fortune 500 Energy and Utilities company. The compelling event that prompted the company to reexamine this situation was the migration to Windows 7. In Windows XP, a custom tool that allowed users one of three levels of administrative rights to their workstations would need to be replaced during the Windows …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds