一个网站 多个域名,建站 手机网站,seo优化专家,谷歌浏览器下载官方正版安装 BCGControlBar 库到你的计算机#xff1a; 解压缩 BCGControlBar.zip #xff08;比如#xff0c;到 c:\bcg 目录中#xff09;把 c:\bcg\bin 增加到你的 path 环境变量中#xff0c;运行 Visual C 并且打开 Tools | Options 对话框#xff0c;切换到Directories 页…安装 BCGControlBar 库到你的计算机 解压缩 BCGControlBar.zip 比如到 c:\bcg 目录中把 c:\bcg\bin 增加到你的 path 环境变量中运行 Visual C 并且打开 Tools | Options 对话框切换到Directories 页并且把 c:\bcg\bcgcontrolbar 加入到 include 目录 中把 c:\bcg\bin 加入 library 和 executable 目录中打开Bcgcontrolbar 和/或 BcgcontrolbarStatic 项目路径是 c:\bcg\bcgcontrolbar 并且选择需要的选项如果要安装 BCGControlBar 应用程序向导只需要打开BCGBAppWizard 项目并编译链接。你将在项目列表中看到一个新的条目。你必须编译链接所有的 BCGControlBar 库的 DLL 文件 打开 BCGControlBar 项目并编译链接。下面是一个你将得到的 DLLs 和 库文件列表 BCGCB***D.dll, BCGCB***D.libDLL debug versionBCGCB***.dll, BCGCB***.libDLL release versionBCGCB***UD.dll, BCGCB***UD.libDLL debug version, UNICODEBCGCB***U.dll, BCGCB***U.libDLL release version UNICODEBCGCB***StaticD.libstatic library debug versionBCGCB***StaticDS.libstatic library debug version, MFC shared DLL*BCGCB***Static.libstatic library release versionBCGCB***StaticS.libstatic library release version, MFC shared DLL*BCGCB***StaticUD.libstatic library debug version, UNICODEBCGCB***StaticUDS.libstatic library debug version, UNICODE, MFC shared DLL*BCGCB***U.libstatic library release version, UNICODEBCGCB***US.libstatic library release version, UNICODE, MFC shared DLL* *** 表示版本号。比如如果你使用的库版本为 5.00 发行版 DLL 的相应的发行版本为 BCGCB500.dll* static library version with MFC shared DLL 适用于 4.7 或更高版本。 所有这些文件将定位在你的 BCGLibrary Directory\Bin 目录中。 记得要把这些目录加入你的系统目录中。 请按如下内容改变你的源代码 添加 BCGControlBar 路径到 INCLUDE 路径确定你在你的应用程序中调用 了 AfxOleInit() InitInstance()添加下列语句到 stdafx.h 文件 #include BCGCB.h 添加 CBCGWorkspace-派生到你的应用程序类 class CMyApp : public CWinApp, public CBCGWorkspace 首先你必须定义在注册表中存放你自定义数据的位置和你 需要什么样的自定义鼠标、键盘、上下文菜单为了做这些工作在CMyApp::InitInstance 中设置注册表入口并初始化自定义管理器 SetRegistryBase (_T(Settings));// 初始化自定义管理器InitMouseManager();InitContextMenuManager();InitKeyboardManager(); 如果你已经决定使用鼠标或上下文菜单的自定义功能你必 须在鼠标自定义管理器中附加一个视图或初始化上下文菜单。重载CBCGWorkspace::PreLoadState 行为 class CMyApp ....{...virtual void PreLoadState();...};void CMyApp::PreLoadState(){ // 把鼠 标事件连接到特定 的视图 : GetMouseManager()-AddView (iIdTestView, _T(Test view), IDR_VIEW); // 初始化上下文菜单 GetContextMenuManager()-AddMenu (_T(Test menu), idMenu); } 同时在 mainfrm.h 和 mainfrm.cpp 文件中 把 CMDIFrameWnd 变成 CBCGMDIFrameWnd 在 SDI 应用程序的情况下 把 CFrameWnd 变成 CBCGFrameWnd把 CMDIChildWnd 变成 CBCGMDIChildWnd把 CToolbar 变成 CBCGToolBar 并且添加一个内嵌菜单栏对象到你的 CMainFrame 类中 CBCGMenuBar m_wndMenuBar; // 新的菜单栏CBCGToolBar m_wndToolBar; // 应用程序工具栏 在 CMainFrame::OnCreate() 行为中添加如下的行以便使能菜单栏功能 // 创建菜单栏替换标准菜单if (!m_wndMenuBar.Create (this)){ TRACE0(Failed to create menubar\n); return -1; //创建失败} m_wndMenuBar.SetBarStyle (m_wndMenuBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); 为了使能菜单栏停靠你应当添加如下代码 m_wndMenuBar.EnableDocking (CBRS_ALIGN_ANY);DockControlBar (m_wndMenuBar); 重要之处 你可以在应用程序中使用任何数目的CBCGToolBar 工具栏。所有的工具栏图像将被合并到一个位图文件中。无论如何仅仅有一个CBCGMenuBar 对象被使用。 为了使能 工具栏/菜单 的自定义请作出如下改变 添加 工具栏/菜单 自定义命令比如View | Customize...实现 OnViewCustomize 行为。代码看起来如下 void CMainFrame::OnViewCustomize() {// 创建一个自定义工具栏对话框CBCGToolbarCustomize* pDlgCust new CBCGToolbarCustomize (this, TRUE /* Automatic menus scaning */); // 添加预定义工具栏pDlgCust-AddToolBar (Main, IDR_MAINFRAME);.... // 添加用户自定义命令pDlgCust-AddButton (User, CBCGToolbarButton (ID_USER_TOOL1, 1, User Tool 1, TRUE));pDlgCust-AddButton (User, CBCGToolbarButton (ID_USER_TOOL2, 2, User Tool 2, TRUE));pDlgCust-AddButton (User, CBCGToolbarButton (ID_USER_TOOL3, 3, User Tool 3, TRUE));.... pDlgCust-SetUserCategory (User); // 使能用户自定义工具栏的 Create/Delete pDlgCust-EnableUserDefinedToolbars (); pDlgCust-Create ();} 为了使能 Microsoft?Office 2000 菜单 定义你自己的基本命令集合通常在CMainFrame::OnCreate()中 CListUINT, UINT lstBasicCoomads;lstBasicCoomads.AddTail (ID_FILE_NEW);lstBasicCoomads.AddTail (ID_FILE_OPEN);lstBasicCoomads.AddTail (ID_FILE_SAVE); ......lstBasicCoomads.AddTail (ID_APP_ABOUT);CBCGToolBar::SetBasicCommands (lstBasicCoomads); 这些命令将显示在下拉菜单中为了使能菜单阴影 CBCGMenuBar::EnableMenuShadows (BOOL bEnable TRUE) 注意 如果你查看的内容可能动态改变就不要在弹出式菜单中使用菜单 阴影比如视图显示动画、HTML页在这种情况下菜单阴影 会记忆以前的视图图像。 为了在运行时改变菜单字体 CBCGMenuBar::SetMenuFont (LPLOGFONT lpLogFont, BOOL bHorz TRUE); 为了使能“页面”自定义按钮只需要调用 m_wndToolBar.EnableCustomizeButton (TRUE, id_of_customize_command,_T(Customize...)); 为了使能图像覆盖下的文字 m_wndToolBar.EnableTextLabels (BOOL bEnable TRUE); 为了使能用户自定义工具 添加一个新的菜单条目ID_TOOLS_ENTRY。该条目将 自动被实际存在的工具列表取代。添加如下的条目到 STRING 资源ID_TOOL1 Activates user-defined tool\nUser ToolID_TOOL2 Activates user-defined tool\nUser Tool....ID_TOOLx Activates user-defined tool\nUser Tool在应用程序的InitInstance() 中调用EnableUserTools (ID_TOOLS_ENTRY, ID_TOOL1, ID_TOOLx);一个 Tools 新页面将加入到自定义对话框中为了使能动态可裁剪菜单 在 STRING 资源表中保留部分条目。这些标识符将被当作控制栏标识符使用。ID_TEAR_OFF1 dummyID_TEAR_OFF2 dummy.......ID_TEAR_OFFx dummy对于每一个可裁剪弹出式菜单把 Break 属性改位 Bar (MF_MENUBARBREAK)在应用程序的 InitInstance() 中调用EnableTearOffMenus (_T(RegBase, ID_TEAR_OFF1, ID_TEAR_OFFx);为了使能静态可裁剪菜单 在 STRING 资源表中保留一个条目。这个标识符将区别于动态 可裁剪 标识符如上所述。ID_TEAR_OFF_BAR dummy在主框架的 OnShowPopupMenu为特定的菜单按钮使能可裁剪pMenuButton-SetTearOff (D_TEAR_OFF_BAR); BCGControlBar9.0的注册密码6CA746D4-8A7B-4373-B550-18F56C26D785转载于:https://www.cnblogs.com/vipwtl/p/6146359.html