BCGControlBar教程:Outlook Bars

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

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

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

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

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

BCG

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

  1. 将Outlook页面大图标列表添加到您的应用程序资源(建议的图标大小为24×24。例如,资源ID将为IDB_PAGES。
  2. 将Outlook页面小图标列表(将显示在位于底部的工具栏上)添加到您的应用程序资源(建议的图标大小为16×16)。 例如,资源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 barn");    return FALSE; // fail to create}CBCGPOutlookWnd* pShortcutsBarContainer = DYNAMIC_DOWNCAST    (CBCGPOutlookWnd, m_wndShortcutsBar.GetUnderlinedWindow ());if (pShortcutsBarContainer == NULL){    TRACE0("Cannot get outlook bar containern");    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);

     

购买BCGSoft正版授权,请点击“咨询在线客服”哟!

标签:BCGUI界面C/C++控件

来源:慧都

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2018年11月2日
下一篇 2018年11月2日

相关推荐

发表回复

登录后才能评论