2024年6月11日发(作者:)

BCG界面库在VC工程中的应用步骤(转载)

(2010-05-13 10:24:14)

转载

标签: 分类:VisualC++系列

杂谈

BCGControlBar Library Professional Edition installation:

整个库的源代码安装在BCGCBPro 目录下面.可执行文件(*.dll)安装在

dir>Bin (for VisualStudio 6.0) 或Bin7 (for VisualStudio .NET)下面。

请在你的源代码中做如下的改变:

 在应用程序的Include路径中加入BCGCBPro目录,具体添加办法如下:vs2005

下面打开菜单工具的Option项,选择项目解决方案-〉vc++目录,然后将包含文

BCGCBPro 添加进去。

 确信在你的应用程序的 InitInstance() 方法中调用了AfxOleInit() 。

 在stdafx.h中加入下面的包含文件:

#include "BCGCBProInc.h"

 使你的应用程序派生自:CBCGPWorkspace

class CMyApp : public CWinApp,

public CBCGPWorkspace

 第一步,你需要定义一个在注册表里保存个性化数据的项并且鼠标,键盘和上下文

菜单都需要。为了实现这一点,CMyApp::InitInstance set registry entry and

initialize customization managers:

SetRegistryBase (_T("Settings"));

// Initialize customization managers:

InitMouseManager();

InitContextMenuManager();

InitKeyboardManager();

 如果你决定使你的鼠标和菜单具有个性化,你需要 "attach" 一个需要的视图初始

化鼠标和菜单的个性化管理。重载 CBCGPWorkspace::PreLoadState 方法:

class CMyApp ....

{

...

virtual void PreLoadState();

...

};

void CMyApp::PreLoadState()

{

// Associate mouse event with specific view(s):

GetMouseManager()->AddView (iIdTestView, _T("Test view"), IDR_VIEW);

// Initialize context menus:

GetContextMenuManager()->AddMenu (_T("Test menu"), idMenu);

}

 把框架文件中的基类CMDIFrameWnd 改为 CBCGPMDIFrameWnd (in case of

SDI application change CFrameWnd to CBCGPFrameWnd)

 将子框架的基类 CMDIChildWnd 改为 CBCGPMDIChildWnd