BCGControlBar使用入门指南

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

本文主要介绍如何将现有的MFC应用程序添加到BCGControlBar Pro中(如果您想要创建一个全新的应用程序,请使用我们的Application Wizard)。让我们想象您已经拥有了一个具有菜单、工具栏和状态栏的典型MFC应用程序。在您的代码中做以下更改:

1. 将以下代码添加到stdafx.h文件中:

1
#include "BCGCBProInc.h"

所需要的库将会自动链接您的项目——您不必在项目链接器设置中添加它。假设我们 的集成向导已正确完成,您的Visual Studio C++文件夹列表已经包含到BCGControlBar Pro目录中。

2. 从CBCGPWinApp中派生您的应用程序类:

1
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样式的功能导航栏,请阅读以下文章来了解这种技术:

  • Office-style Ribbon Bar
  • Ribbon Backstage View - Walkthrough
  • Ribbon Designer

8. 添加嵌入式菜单栏对象到您的CMainFrame类中:CBCGPMenuBar m_wndMenuBar,同时在CMainFrame::OnCreate:中创建该对象。

1
2
3
m_wndMenuBar.Create( this );
m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndMenuBar);

9. 在您应用程序的构造函数开头设置应用程序可视化样式:

1
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)

有兴趣的朋友点击查看更多BCG教程>>

你可能感兴趣的:(BCGControlBar使用入门指南)