BCGControlBar Library Professional Edition installation:
整个库的源代码安装在<install dir>\BCGCBPro 目录下面.可执行文件(*.dll)安装在 <install dir>\Bin (for VisualStudio 6.0) 或<install dir>\Bin7 (for VisualStudio .NET)下面。
请在你的源代码中做如下的改变:
#include “BCGCBProInc.h”
class CMyApp : public CWinApp, public CBCGPWorkspace
SetRegistryBase (_T(“Settings“)); // Initialize customization managers: InitMouseManager(); InitContextMenuManager(); InitKeyboardManager();
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); }
CBCGPMenuBar m_wndMenuBar; // New menu bar CBCGToolBar m_wndToolBar; // Application toolbar
// Create menu bar (replaces the standard menu): if (!m_wndMenuBar.Create (this)) { TRACE0(“Failed to create menubar\n”); return -1; // fail to create } m_wndMenuBar.SetBarStyle (m_wndMenuBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndMenuBar.EnableDocking (CBRS_ALIGN_ANY); DockControlBar (&m_wndMenuBar);
Important:在你的应用程序中,你可以使用多个 CBCGPToolBar .所用工具条的图像将自动合并到一张位图上 . 但是只有一个CBCGPMenuBar 对象可以使用.
为了具有自定义工具条和菜单条, 请做如下改变:
void 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: pDlgCust->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_TOOL3, 3, “User Tool 3”, TRUE)); …. pDlgCust->SetUserCategory (“User”); // Enable Create/Delete of the user-defined toolbars: pDlgCust->EnableUserDefinedToolbars (); pDlgCust->Create (); }
为了能具有 Microsofte Office 2000 的菜单风格:
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 (lstBasicCoomads);
使菜单项是否具有阴影的风格:
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 remember” 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.EnableTextLabels (BOOL bEnable = TRUE);
使用户能自定义工具:
To enable dynamic “tear-off” (“detachable”) menus:
To enable static “tear-off” (“detachable”) menus:
To ensure, that all BCGPControlBar allocations are freed properly:
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/184520.html原文链接:https://javaforall.cn