BCGControlBar教程:Outlook Bars
发布日期:2021-05-04 18:19:47 浏览次数:22 分类:精选文章

本文共 2388 字,大约阅读时间需要 7 分钟。

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

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

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

BCG

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

  1. 将Outlook页面大图标列表添加到您的应用程序资源(建议的图标大小为24x24。例如,资源ID将为IDB_PAGES。
  2. 将Outlook页面小图标列表(将显示在位于底部的工具栏上)添加到您的应用程序资源(建议的图标大小为16x16)。 例如,资源ID将是IDB_PAGES_SMALL。
  3. 为每个快捷方式(IDI_SHORTCUT1,IDI_SHORTCUT1,...)准备图标。
  4. 将以下成员添加到您的CMainFrame类:
    1. CBCGPOutlookBar m_wndShortcutsBar;
    2. CBCGPOutlookBarPane m_wndShortcutsPane1;
    3. 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);

     

上一篇:BCGControlBar教程:可视化管理器
下一篇:BCGControlBar教程:如何在工具栏上放置控件

发表评论

最新留言

第一次来,支持一个
[***.219.124.196]2025年04月14日 07时54分16秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章