文檔金喜正規買球>>BCGControlBar使用教程>>BCGControlBar工具欄編輯器教程:Outlook Bars
BCGControlBar工具欄編輯器教程:Outlook Bars
BCGControlBar Library框架支持Outlook樣式的快捷方式控制欄。您可以使用這些欄來增強應用程序中的工作區管理。
快捷方式欄具有以下元素:
- 標題 - 顯示當前選擇的頁面名稱
- 帶快捷按鈕或嵌入式控件的頁面
- 頁面和頁面按鈕之間的拆分器
- 左側有頁面名稱和圖標的頁面按鈕
- 位于底部的工具欄,帶有頁面小圖標和選項菜單
“outlook”控制條的功能由CBCGPOutlookBar 類提供。要使用此課程,請執行以下步驟:
- 將Outlook頁面大圖標列表添加到您的應用程序資源(建議的圖標大小為24x24。例如,資源ID將為IDB_PAGES。
- 將Outlook頁面小圖標列表(將顯示在位于底部的工具欄上)添加到您的應用程序資源(建議的圖標大小為16x16)。例如,資源ID將是IDB_PAGES_SMALL。
- 為每個快捷方式(IDI_SHORTCUT1,IDI_SHORTCUT1,...)準備圖標。
- 將以下成員添加到您的CMainFrame類:
- CBCGPOutlookBar m_wndShortcutsBar;
- CBCGPOutlookBarPane m_wndShortcutsPane1;
- CBCGPOutlookBarPane m_wndShortcutsPane2;
- 通過以下方式初始化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);