BCGControlBar工具栏编辑器教程:Outlook Bars

BCGControlBar Pro for MFC最新试用版下载请猛戳>>>

BCGControlBar Library框架支持Outlook样式的快捷方式控制栏。您可以使用这些栏来增强应用程序中的工作区管理。

快捷方式栏具有以下元素:

  • 标题 - 显示当前选择的页面名称
  • 带快捷按钮或嵌入式控件的页面
  • 页面和页面按钮之间的拆分器
  • 左侧有页面名称和图标的页面按钮
  • 位于底部的工具栏,带有页面小图标和选项菜单

BCGControlBar

“outlook”控制条的功能由CBCGPOutlookBar 类提供。要使用此课程,请执行以下步骤:

  1. 将Outlook页面大图标列表添加到您的应用程序资源(建议的图标大小为24x24。例如,资源ID将为IDB_PAGES
  2. 将Outlook页面小图标列表(将显示在位于底部的工具栏上)添加到您的应用程序资源(建议的图标大小为16x16)。例如,资源ID将是IDB_PAGES_SMALL。
  3. 为每个快捷方式(IDI_SHORTCUT1,IDI_SHORTCUT1,...)准备图标。
  4. 将以下成员添加到您的CMainFrame类:
    • CBCGPOutlookBar m_wndShortcutsBar;
    • CBCGPOutlookBarPane m_wndShortcutsPane1;
    • CBCGPOutlookBarPane  m_wndShortcutsPane2;
  5. 通过以下方式初始化CMainFrame :: OnCreate中的快捷方式栏:
CBCGPOutlookWnd::EnableAnimation ();

const int nInitialWidth = 150;
const CString strCaption = _T("Shortcuts");

m_wndShortcutsBar.SetMode2003();

if (!m_wndShortcutsBar.Create (strCaption, this,  CRect (0, 0, nInitialWidth, nInitialWidth), 
      ID_VIEW_OUTLOOKBAR, WS_CHILD | WS_VISIBLE | CBRS_LEFT))
{
    TRACE0("Failed to create outlook bar\n");
    return FALSE; // fail to create
}

CBCGPOutlookWnd* pShortcutsBarContainer = DYNAMIC_DOWNCAST
    (CBCGPOutlookWnd, m_wndShortcutsBar.GetUnderlinedWindow ());
if (pShortcutsBarContainer == NULL)
{
    TRACE0("Cannot get outlook bar container\n");
    return FALSE;
}

pShortcutsBarContainer->SetImageList(IDB_PAGES, 24);
pShortcutsBarContainer->SetToolbarImageList(IDB_PAGES_SMALL, 16);

// Create first page:
m_wndShortcutsPane1.Create (&m_wndShortcutsBar, dwDefaultToolbarStyle,
     ID_SHORTCUTS_PANE_1);
m_wndShortcutsPane1.SetOwner (this);
m_wndShortcutsPane1.EnableTextLabels ();
m_wndShortcutsPane1.EnableDocking (CBRS_ALIGN_ANY);

m_wndShortcutsPane1.AddButton (theApp.LoadIcon(IDI_SHORTCUT1), _T("Shortcut 1"),
     ID_SHORTCUT_1);
m_wndShortcutsPane1.AddButton (theApp.LoadIcon(IDI_SHORTCUT2), _T("Shortcut 2"),
     ID_SHORTCUT_2);

pShortcutsBarContainer->AddTab (&m_wndShortcutsPane1, _T("Page 1"), 0, FALSE);
m_wndShortcutsPane1.EnableDocking (CBRS_ALIGN_ANY);

// Create second page:
m_wndShortcutsPane2.Create (&m_wndShortcutsBar,  dwDefaultToolbarStyle,
    ID_SHORTCUTS_PANE_2);

m_wndShortcutsPane2.SetOwner (this);
m_wndShortcutsPane2.EnableTextLabels ();
m_wndShortcutsPane2.EnableDocking (CBRS_ALIGN_ANY);

m_wndShortcutsPane2.AddButton (theApp.LoadIcon(IDI_SHORTCUT3), _T("Shortcut 3"),
    ID_SHORTCUT_3);
m_wndShortcutsPane2.AddButton (theApp.LoadIcon(IDI_SHORTCUT4), _T("Shortcut 4"),
    ID_SHORTCUT_4);

pShortcutsBarContainer->AddTab (&m_wndShortcutsPane2, _T("Page 2"), 1, FALSE);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值