BCGControlBar使用入門指南
本文主要介紹如何將現有的MFC應用程序添加到BCGControlBar Pro中(如果您想要創(chuàng)建一個全新的應用程序,請使用我們的Application Wizard)。讓我們想象您已經擁有了一個具有菜單、工具欄和狀態(tài)欄的典型MFC應用程序。在您的代碼中做以下更改:
1. 將以下代碼添加到stdafx.h文件中:
#include "BCGCBProInc.h"
所需要的庫將會自動鏈接您的項目——您不必在項目鏈接器設置中添加它。假設我們 的集成向導已正確完成,您的Visual Studio C++文件夾列表已經包含到BCGControlBar Pro目錄中。
2. 從CBCGPWinApp中派生您的應用程序類:
class CMyApp : public CBCGPWinApp
3. 請確保在您應用程序的InitInstance()中調用CBCGPWinApp::InitInstance()和AfxOleInit()。
4. 添加以下調用InitInstance(): SetRegistryKey(_T("MyCompany\\MyProduct"));
5. 在您應用程序ExitInstance()中調用BCGCBProCleanUp()。
6.下面的類名使用全局替換:
- CFrameWnd -> CBCGPFrameWnd
- CMDIFrameWnd -> CBCGPMDIFrameWnd
- CMDIChildWnd -> CBCGPMDIChildWnd
- CToolBar -> CBCGPToolBar
- CStatusBar ->CBCGPStatusBar.
7. 如果您想添加Microsoft Office 2007/2010/2013/2016樣式的功能導航欄,請閱讀以下文章來了解這種技術:
8. 添加嵌入式菜單欄對象到您的CMainFrame類中:CBCGPMenuBar m_wndMenuBar,同時在CMainFrame::OnCreate:中創(chuàng)建該對象。
m_wndMenuBar.Create(this); m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndMenuBar);
9. 在您應用程序的構造函數開頭設置應用程序可視化樣式:
SetVisualTheme(theme);
其中,主題是:
BCGP_VISUAL_THEME_DEFAULT | Windows native theme |
BCGP_VISUAL_THEME_OFFICE_2000 | MS Office 2000/VC++ 6.0 look |
BCGP_VISUAL_THEME_OFFICE_XP | MS Office XP/Visual Studio.NET look |
BCGP_VISUAL_THEME_OFFICE_2003 | MS Office 2003 look |
BCGP_VISUAL_THEME_VS_2005 | Visual Studio 2005 look |
BCGP_VISUAL_THEME_OFFICE_2007_BLUE | MS Office 2007 look (blue) |
BCGP_VISUAL_THEME_OFFICE_2007_BLACK | MS Office 2007 look (black) |
BCGP_VISUAL_THEME_OFFICE_2007_SILVER | MS Office 2007 look (silver) |
BCGP_VISUAL_THEME_OFFICE_2007_AQUA | MS Office 2007 look (aqua) |
BCGP_VISUAL_THEME_CARBON | Carbon |
BCGP_VISUAL_THEME_VS_2008 | Visual Studio 2008 look |
BCGP_VISUAL_THEME_VS_2010 | Visual Studio 2010 look |
BCGP_VISUAL_THEME_OFFICE_2010_BLUE | MS Office 2010 look (blue) |
BCGP_VISUAL_THEME_OFFICE_2010_BLACK | MS Office 2010 look (black) |
BCGP_VISUAL_THEME_OFFICE_2010_SILVER | MS Office 2010 look (silver) |
BCGP_VISUAL_THEME_SCENIC | Windows 7/8 Ribbon look. |
BCGP_VISUAL_THEME_VS_2012_LIGHT | Visual Studio 2012 look (light) |
BCGP_VISUAL_THEME_VS_2012_DARK | Visual Studio 2012 look (dark) |
BCGP_VISUAL_THEME_VS_2012_BLUE | Visual Studio 2012 look (blue) |
BCGP_VISUAL_THEME_OFFICE_2013_WHITE | MS Office 2013 look (white) |
BCGP_VISUAL_THEME_OFFICE_2013_GRAY | MS Office 2013 look (gray) |
BCGP_VISUAL_THEME_OFFICE_2013_DARK_GRAY | MS Office 2013 look (dark gray) |
BCGP_VISUAL_THEME_OFFICE_2016_WHITE | MS Office 2016 look (white) |
BCGP_VISUAL_THEME_OFFICE_2016_COLORFUL | MS Office 2016 look (colorful) |
BCGP_VISUAL_THEME_OFFICE_2016_DARK_GRAY | MS Office 2016 look (dark gray) |