轉(zhuǎn)帖|使用教程|編輯:鮑佳佳|2021-07-26 13:54:30.110|閱讀 506 次
概述:BCGControlBar是一個(gè) MFC 擴(kuò)展庫(kù),允許您創(chuàng)建具有完全自定義選項(xiàng)(功能區(qū)、可自定義工具欄、菜單等)和一組豐富的專業(yè)設(shè)計(jì)的 Microsoft Office 和 Microsoft Visual Studio 類應(yīng)用程序GUI 控件,本文講解如何安裝使用BCGControlBars.
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
BCGControlBar是一個(gè) MFC 擴(kuò)展庫(kù),允許您創(chuàng)建具有完全自定義選項(xiàng)(功能區(qū)、可自定義工具欄、菜單等)和一組豐富的專業(yè)設(shè)計(jì)的 Microsoft Office 和 Microsoft Visual Studio 類應(yīng)用程序GUI 控件,例如圖表、日歷、網(wǎng)格、編輯器、甘特圖等。
擁有 500 多個(gè)經(jīng)過(guò)徹底設(shè)計(jì)、測(cè)試和完整記錄的 MFC 擴(kuò)展類。我們的組件可以輕松集成到您的應(yīng)用程序中,并為您節(jié)省數(shù)百小時(shí)的開發(fā)和調(diào)試時(shí)間。
打開 BCGControlBar 項(xiàng)目并編譯鏈接。下面是一個(gè)你將得到的 DLLs 和 庫(kù)文件列表:
BCGCB***D.dll, BCGCB***D.lib DLL debug version BCGCB***.dll, BCGCB***.lib DLL release version BCGCB***UD.dll, BCGCB***UD.lib DLL debug version, UNICODE BCGCB***U.dll, BCGCB***U.lib DLL release version UNICODE BCGCB***StaticD.lib static library debug version BCGCB***StaticDS.lib static library debug version, MFC shared DLL* BCGCB***Static.lib static library release version BCGCB***StaticS.lib static library release version, MFC shared DLL* BCGCB***StaticUD.lib static library debug version, UNICODE BCGCB***StaticUDS.lib static library debug version, UNICODE, MFC shared DLL* BCGCB***U.lib static library release version, UNICODE BCGCB***US.lib static library release version, UNICODE, MFC shared DLL*
*** 表示版本號(hào)。比如,如果你使用的庫(kù)版本為 5.00 發(fā)行版, DLL 的相應(yīng)的發(fā)行版本為 BCGCB500.dll
* static library version with MFC shared DLL 適用于 4.7 或更高版本。
所有這些文件將定位在你的 <BCGLibrary Directory>\Bin 目錄中。 記得要把這些目錄加入你的系統(tǒng)目錄中。
請(qǐng)按如下內(nèi)容改變你的源代碼:
#include "BCGCB.h"
class CMyApp : public CWinApp,
public CBCGWorkspace
SetRegistryBase (_T("Settings"));
// 初始化自定義管理器:
InitMouseManager();
InitContextMenuManager();
InitKeyboardManager();
class CMyApp ....
{
...
virtual void PreLoadState();
...
};
void CMyApp::PreLoadState()
{
// 把鼠 標(biāo)事件連接到特定 的視圖 :
GetMouseManager()->AddView (iIdTestView, _T("Test view"), IDR_VIEW);
// 初始化上下文菜單:
GetContextMenuManager()->AddMenu (_T("Test menu"), idMenu);
}
CBCGMenuBar m_wndMenuBar; // 新的菜單欄
CBCGToolBar m_wndToolBar; // 應(yīng)用程序工具欄
// 創(chuàng)建菜單欄(替換標(biāo)準(zhǔn)菜單):
if (!m_wndMenuBar.Create (this))
{
TRACE0("Failed to create menubar\n");
return -1; //創(chuàng)建失敗
}m_wndMenuBar.SetBarStyle (m_wndMenuBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
m_wndMenuBar.EnableDocking (CBRS_ALIGN_ANY);
DockControlBar (&m_wndMenuBar);
重要之處: 你可以在應(yīng)用程序中使用任何數(shù)目的CBCGToolBar 工具欄。所有的工具欄圖像將被合并到一個(gè)位圖文件中。無(wú)論如何,僅僅有一個(gè)CBCGMenuBar 對(duì)象被使用。
為了使能 Microsoft Office 2000 菜單:
void CMainFrame::OnViewCustomize()
{
// 創(chuàng)建一個(gè)自定義工具欄對(duì)話框:
CBCGToolbarCustomize* pDlgCust = new CBCGToolbarCustomize (this,
TRUE /* Automatic menus scaning */);// 添加預(yù)定義工具欄:
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 ();
}
CList<UINT, 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)
注意 如果你查看的內(nèi)容可能動(dòng)態(tài)改變就不要在彈出式菜單中使用菜單 陰影(比如,視圖顯示動(dòng)畫、HTML頁(yè))在這種情況下,菜單陰影 會(huì)記憶以前的視圖圖像。
CBCGMenuBar::SetMenuFont (LPLOGFONT lpLogFont, BOOL bHorz = TRUE);
m_wndToolBar.EnableCustomizeButton (TRUE, id_of_customize_command,
_T("Customize..."));
m_wndToolBar.EnableTextLabels (BOOL bEnable = TRUE);
EnableUserTools (ID_TOOLS_ENTRY, ID_TOOL1, ID_TOOLx); |
EnableTearOffMenus (_T("RegBase", ID_TEAR_OFF1, ID_TEAR_OFFx); |
pMenuButton->SetTearOff (D_TEAR_OFF_BAR); |
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@ke049m.cn
文章轉(zhuǎn)載自: