您的位置:首页 > 其它

CodeProject: Collapsible, resizable and dockable XP style control bar. Free source code and programming help

2008-07-24 23:19 776 查看
Download demo project - 209 Kb



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
:
CCollapsiblePanelm_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);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐