本文以MDI应用程序为例说明如何在已有的VC++工程中使用BCG界面库,我的开发环境为VS2003。
1,将BCG/BCGCBPro目录路径添加到“项目属性->C/C++ ->常规 ->附加包含目录”中,同时将BCG/Bin目录路径添加到“项目属性->链接器 ->常规 ->附加库目录”中。
2,确保在CWinApp派生类(设为CMyApp)的InitInstance()成员函数中调用AfxOleInit();
3,在ExitInstance()函数中添加:
<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">CleanState();<br style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">BCGCBProCleanUp();</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
4,在stdafx.h中添加
<wbr style="">#include "bcg/<span style="color:#800000">BCGCBProInc.h"</span></wbr>
5,为CMyApp添加基类,如下:
<wbr style="">class CMyApp:public CWinApp,public CBCGPWorkspace</wbr>
6,设置个性化的数据在注册表中的存放位置和需要个性化的特性。在CMyApp::InitInstance()函数中添加:
<wbr style=""><wbr style="">SetRegistryBase(_T("Settings"));</wbr></wbr>
<wbr style=""><wbr style=""><span style="color:#800000">InitMouseManager();<br style=""><wbr style=""><wbr style="">InitContextMenuManager();<br style=""><wbr style=""><wbr style="">InitKeyboardManager();</wbr></wbr></wbr></wbr></span></wbr></wbr>
7,将CMDIFrameWnd 修改为 CBCGPMDIFrameWnd,注意MainFrm.h和MainFrm.cpp中的所有CMDIFrameWnd都要改。
8,将CMDIChildWnd改成CBCGPMDIChildWnd,.h和.cpp中的都要改。
9,将CToolBar<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">m_wndToolBar修改成CBCGPToolBar m_wndToolBar,并在你的CMainFrame类中添加一个CBCGPMenuBar类型的成员m_wndMenuBar,如下示:</wbr></wbr></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style="">CBCGPMenuBar<wbr style=""><wbr style=""><wbr style="">m_wndMenuBar;<wbr style=""><wbr style=""><wbr style=""><span style="color:#008000"><wbr style="">// New menu bar</wbr></span><span style="color:#800000"><br style=""><wbr style=""><wbr style=""><wbr style="">CBCGPToolBar<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">m_wndToolBar;<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#008000">//
Application toolbar</span></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
10,为使菜单条生效并且可停靠,在CMainFrame::OnCreate()函数中添加以下内容:
<wbr style=""><wbr style=""><wbr style=""><span style="color:#800000">if (!m_wndMenuBar.Create (</span><span style="color:#0000ff">this</span><span style="color:#800000">)){<br style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">TRACE0("Failed to create menubar\n");<br style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></span><span style="color:#0000ff">return</span><span style="color:#800000">-1;<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""></wbr></wbr></wbr></wbr></wbr></span><span style="color:#008000">//
fail to create</span><span style="color:#800000"><br style=""><wbr style=""><wbr style=""><wbr style="">}</wbr></wbr></wbr></span></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style="">m_wndMenuBar.SetBarStyle(m_wndMenuBar.GetBarStyle() |<br style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">CBRS_TOOLTIPS
| CBRS_FLYBY |</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">CBRS_SIZE_DYNAMIC);</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style="">m_wndMenuBar.EnableDocking (CBRS_ALIGN_ANY);<br style=""><wbr style=""><wbr style=""><wbr style="">DockControlBar (&m_wndMenuBar);</wbr></wbr></wbr></wbr></wbr></wbr></wbr>
说明:你可以在你的应用程序中使用多个CBCGPToolBar,它们对应的位图将会自动地合并在一张位图上,然而,你只可以使用一个CBCGPMenuBar对象。
<wbr style=""><wbr style=""><wbr style="">至此基本设置已经完成,此时你的程序应该可以正常地编译运行。下面介绍如何为应用程序设置不同的风格。</wbr></wbr></wbr>
1,在菜单栏上添加一个弹出菜单,在其中添加一个菜单项,上面的文字分别为"Office 2003","Office 2007(blue)","Office 2007(black)","Office 2007(silver)","Office 2007(aqua)",对应的菜单项ID分别为ID_VIEW_APPLOOK_2003,ID_VIEW_APPLOOK_2007_1,,ID_VIEW_APPLOOK_2007_2,ID_VIEW_APPLOOK_2007_3,ID_VIEW_APPLOOK_2007_4。
2,为这五个菜单添加消息响应:
<wbr style=""><wbr style="">在MainFrm.cpp文件中,添加消息映射(在BEGIN_MESSAGE_MAP和END_MESSAGE_MAP之间):</wbr></wbr>
<wbr style=""><wbr style="">ON_COMMAND_RANGE(ID_VIEW_APPLOOK_2003, ID_VIEW_APPLOOK_2007_4, OnAppLook)</wbr></wbr>
<wbr style=""><wbr style=""><span style="color:#800000">在CMainFrame类中添加OnAppLook函数声明:</span></wbr></wbr>
<wbr style=""><wbr style="">afx_msg void OnAppLook(UINT id);</wbr></wbr>
<wbr style=""><wbr style="">添加其方法实现:</wbr></wbr>
<wbr style=""><wbr style="">void CMainFrame::OnAppLook(UINT id){<br style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">CWaitCursor wait;</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">CBCGPVisualManager2007::SetCustomColor ((COLORREF)-1);</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">switch (id){<br style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">case ID_VIEW_APPLOOK_2003:CBCGPVisualManager::SetDefaultManager(</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">RUNTIME_CLASS
(CBCGPVisualManager2003));<br style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">break;</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">case
ID_VIEW_APPLOOK_2007_1:</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">CBCGPVisualManager2007::SetStyle
(CBCGPVisualManager2007::VS2007_Aqua);</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>CBCGPVisualManager::SetDefaultManager
(
<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">RUNTIME_CLASS
(CBCGPVisualManager2007));</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">break;</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr><wbr style=""><wbr style=""></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">...</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">}<br style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">RedrawWindow (NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW |<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">RDW_FRAME
| RDW_ERASE);</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style=""><wbr style="">}</wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr style=""><wbr style=""><wbr style=""><wbr style="">Office 2007其它的风格样式切换类似ID_VIEW_APPLOOK_2007_1,在此省略。</wbr></wbr></wbr></wbr>
3,运行时请确保程序能够找到Bin目录下的相关DLL,否则切换风格时会失败。
分享到:
相关推荐
bcg界面库21.0 安装后 运行BCGCBProIntegrationWizard 会自动检测你系统里面安装的编译器版本 然后选择编译 生成库文件
对可以做出华丽界面的bcg界面库的主要函数使用进行介绍 类似msdn的排版风格 有助于新手快速熟悉bcg的函数功能
BCG最新界面库源代码,喜欢和需要的参考
BCG最新界面库,喜欢和需要的下载学习,喜欢和需要的下载学习
BCG界面库在VC工程中的应用步骤.doc
CGControlBar Professional 专业版是一套非常好的MFC扩展界面库!可以帮助你在编程时轻松制作出非常漂亮专业的界面!这个是专业版!推荐下载!^_^
安装后 运行BCGCBProIntegrationWizard 会自动检测你系统里面安装的编译器版本 然后选择编译生成库文件
BCGControlBar.专业版.v9.4.Full.Source,还有使用方法啊 是自己下载总结的!
BCG库使用实例 用向导建立BCG工程,并使用BCG类,形成好看的控件
BCG界面库10.0版,对学习和掌握c++设计专业化界面非常有帮助,尽情享受其中的乐趣!。
汉化的BCGCBPro674,绝好的界面方案,资源和向导均完全汉化,不用加载语言包,可用向导快速生成PP的界面。1字节的问题已经过处理,可与GIS使用,并将帮助集成进MSDN。内置有WTL7.1。 直接安装,将BIN目录下的动态库...
BCG库,支持VC6.0 VS2010 VS2012 ,里面包含密钥,可以直接进行安装使用
完整讲述怎样在VS2005软件的基础上安装BCG工具栏,从而使用BCG类库美化界面。
VC界面库BCG,good,请大家下载吧,真的真的真的非常非常好用啊。
BCGContolBar621版,VC6.0 MFC界面扩展库,可以自己创建出很好的界面
这是一个基于BCG的仿360界面的源码,运行前需要装BCG开发包
该项目使用Visual Studio 2008等软件,界面采用BCG设计 实现功能:图形组件的拖放,拉伸,对齐,加锁,解锁,置前,置后,复制,粘贴,属性显示,文件保存与读取。
bcg729 编码库 可以多个平台编译 Bcg729 is a software G729A encoder and decoder library written in C, developed by Belledonne Communications
BCG 的使用说明 时做出的系统有一个漂亮的界面