下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、BCG界面库在VC工程中的应用步骤(2008-12-08 16:19:26) 转载标签: 杂谈分类: 技术转载 BCGControlBar Library Professional Edition installation:整个库的源代码安装在<install dir>BCGCBPro 目录下面.可执行文件(*.dll)安装在 <install dir>Bin (for VisualStudio 6.0) 或<install dir>Bin7 (for VisualStudio .NET)下面。请在你的源代码中做如下的改变:· 在应用程序
2、的Include路径中加入BCGCBPro目录,具体添加办法如下:vs2005下面打开菜单工具的Option项,选择项目解决方案-vc+目录,然后将包含文件<install dir>BCGCBPro 添加进去。 · 确信在你的应用程序的 InitInstance() 方法中调用了AfxOleInit() 。 · 在stdafx.h中加入下面的包含文件: #include "BCGCBProInc.h"· 使你的应用程序派生自:CBCGPWorkspace class CMyApp : public CWinApp,
3、0; public CBCGPWorkspace· 第一步,你需要定义一个在注册表里保存个性化数据的项并且鼠标,键盘和上下文菜单都需要。为了实现这一点,CMyApp:InitInstance set registry entry and initialize customization managers: Set
4、RegistryBase (_T("Settings");/ Initialize customization managers:InitMouseManager();InitContextMenuManager();InitKeyboardManager();· 如果你决定使你的鼠标和菜单具有个性化,你需要 "attach" 一个需要的视图初始化鼠标和菜单的个性化管理。重载 CBCGPWorkspace:PreLoadState 方法: class CMyApp .virtual void PreLoadState();.;void CMyA
5、pp:PreLoadState() / Associate mouse event with specific view(s): GetMouseManager()->AddView (iIdTestView, _T("Test view"), IDR_VIEW); / Initialize context menus: GetContextMenuManager()->AddMenu (_T("Test me
6、nu"), idMenu); · 把框架文件中的基类CMDIFrameWnd 改为 CBCGPMDIFrameWnd (in case of SDI application change CFrameWnd to CBCGPFrameWnd) · 将子框架的基类 CMDIChildWnd 改为 CBCGPMDIChildWnd · 将 CToolbar 改为 CBCGPToolBar 并且加入一个embedded menu bar 在你的CMainFrame类中: CBCGPMenu
7、Bar m_wndMenuBar; / New menu barCBCGToolBar m_wndToolBar; / Application toolbar· 在CMainFrame:OnCreate() 方法中加入下面几行以实现菜单的功能: / Create menu bar (replaces the standard menu):if (!m_wndMenuBar.Create (thi
8、s) TRACE0("Failed to create menubarn"); return -1; / fail to create m_wndMenuBar.SetBarStyle (m_wndMenuBar.GetBarStyle() |
9、 CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);· 加入以下代码以实现ca: m_wndMenuBar.EnableDocking (CBRS_ALIGN_ANY);DockControlBar (&am
10、p;m_wndMenuBar);Important:在你的应用程序中,你可以使用多个 CBCGPToolBar .所用工具条的图像将自动合并到一张位图上 . 但是只有一个CBCGPMenuBar 对象可以使用. 为了具有自定义工具条和菜单条, 请做如下改变:· 加入 toolbar/menu customization command (for example, View | Customize.) · Implement OnViewCustomize method. The code will look something like this: vo
11、id CMainFrame:OnViewCustomize() / Create a customize toolbars dialog: CBCGPToolbarCustomize* pDlgCust = new CBCGToolbarCustomize (this,TRUE ); / Add predefined toolbars: pDlgCust->AddToolBar ("Main", IDR_MAINFRAME); . / Add user-defined commands: pDlg
12、Cust->AddButton ("User", CBCGPToolbarButton (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_TO
13、OL3, 3, "User Tool 3", TRUE); . pDlgCust->SetUserCategory ("User"); / Enable Create/Delete of the user-defined toolbars: pDlgCust->EnableUserDefinedToolbars (); pDlgCust->Create ();为了能具有 Microsofte Office 2000 的菜单风格:· Define your o
14、wn basic commands set (usually in CMainFrame:OnCreate(): CList<UINT, UINT> lstBasicCoomads; lstBasicCoomads.AddTail (ID_FILE_NEW);lstBasicCoomads.AddTail (ID_FILE_OPEN);lstBasicCoomads.AddTail (ID_FILE_SAVE);.lstBasicCoomads.AddTail (ID_APP_ABOUT);CBCGPToolBar:SetBasicCommands (lstBasicC
15、oomads);· 这些命令将使得这些菜单能保持常见. 使菜单项是否具有阴影的风格:CBCGPMenuBar:EnableMenuShadows (BOOL bEnable = TRUE)Note: please don't use menu shadows if your views content may be dynamically changed when the popup menu is shown (e.g., views shows animation, HTML page). In this case menu shadow "is remembe
16、r" the previous view image.在运行时改变菜单的字体:CBCGPMenuBar:SetMenuFont (LPLOGFONT lpLogFont, BOOL bHorz = TRUE);使工具条具有"pager" (customization) button just call:m_wndToolBar.EnableCustomizeButton (TRUE, id_of_customize_command,_T("Customize.");使工具条的按钮下具有文字:m_wndToolBar.EnableTextLabe
17、ls (BOOL bEnable = TRUE);使用户能自定义工具:· Add a new menu item: ID_TOOLS_ENTRY. This item will be automatically replaced by the actual tools list · Add the following items to the STRING resource: 1. ID_TOOL1 "Activates user-defined toolnUser Tool" 2. ID_TOOL2
18、60; "Activates user-defined toolnUser Tool". 3. ID_TOOLx "Activates user-defined toolnUser Tool" · In application's InitInstance() call: EnableUserTools (ID_TOOLS_ENTRY, ID_TOOL1, ID_TOOLx);· A new "To
19、ols" page will be added to the customization dialog To enable dynamic "tear-off" ("detachable") menus:· Reserve some items in the STRING resource table. These IDs will be used as control bars IDs1. ID_TEAR_OFF1 "<dummy>" 2. ID_TEAR_OFF2 "<dummy>" 3. . 4. ID_TEAR_OFFx "<dummy>" · For each "tear-off" popup menu, change the "Break" property to "Bar" (MF_MENUBARBREAK) · In application'
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 护理专业解剖学教学资源
- 口腔卫生:口腔喷水的使用
- 护理实验实验培训
- 动脉粥样硬化家庭支持系统
- 护理工作效果评估
- 护理专业的护理职业健康
- 旅游行业旅游公司战略发展规划与实施
- 快速消费品牌销售经理岗位全攻略
- 基于绿色发展的新能源车供能网络建设策略研究
- 基于云计算的远程运维管理服务分析
- 《水力学》课件(共十一章)
- 2025至2030海洋生态行业项目调研及市场前景预测评估报告
- 《教师数字素养》标准解读
- 婴幼儿中医讲座课件
- 耕地代耕代种协议书
- Unit1 understanding ideas 教学设计 2024-2025学年外研版英语七年级下册
- 2025年四川省对口招生(农林牧渔类)《植物生产与环境》考试复习题库(含答案)
- 2024年江苏中职职教高考文化统考语文试卷真题(含答案详解)
- 2024年长江工程职业技术学院高职单招语文历年参考题库含答案解析
- 《合并报表编制》课件
- 临床静脉导管维护专家共识
评论
0/150
提交评论