BCGControlBar教程:Outlook Bars
BCGControlBar?Library框架支持Outlook樣式的快捷方式控制欄。 您可以使用這些欄來(lái)增強(qiáng)應(yīng)用程序中的工作區(qū)管理。
快捷方式欄具有以下元素:
標(biāo)題 - 顯示當(dāng)前選擇的頁(yè)面名稱
帶快捷按鈕或嵌入式控件的頁(yè)面
頁(yè)面和頁(yè)面按鈕之間的拆分器
左側(cè)有頁(yè)面名稱和圖標(biāo)的頁(yè)面按鈕
位于底部的工具欄,帶有頁(yè)面小圖標(biāo)和選項(xiàng)菜單
“outlook”控制條的功能由CBCGPOutlookBar類提供。 要使用此課程,請(qǐng)執(zhí)行以下步驟:
將Outlook頁(yè)面大圖標(biāo)列表添加到您的應(yīng)用程序資源(建議的圖標(biāo)大小為24x24。例如,資源ID將為IDB_PAGES。
將Outlook頁(yè)面小圖標(biāo)列表(將顯示在位于底部的工具欄上)添加到您的應(yīng)用程序資源(建議的圖標(biāo)大小為16x16)。 例如,資源ID將是IDB_PAGES_SMALL。
為每個(gè)快捷方式(IDI_SHORTCUT1,IDI_SHORTCUT1,...)準(zhǔn)備圖標(biāo)。
將以下成員添加到您的CMainFrame類:
CBCGPOutlookBar m_wndShortcutsBar;
CBCGPOutlookBarPane m_wndShortcutsPane1;
CBCGPOutlookBarPane??m_wndShortcutsPane2;
通過(guò)以下方式初始化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);
轉(zhuǎn)載于:https://blog.51cto.com/14048826/2325706
總結(jié)
以上是生活随笔為你收集整理的BCGControlBar教程:Outlook Bars的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 开源 serverless 产品原理剖析
- 下一篇: 如何开发一个用户脚本系列(3)——脚本一