轉(zhuǎn)帖|使用教程|編輯:鮑佳佳|2020-11-03 13:47:12.650|閱讀 797 次
概述:本章為BCGControlBar入門系列教程,前兩章我們講述了如何安裝,以及創(chuàng)建第一個(gè)項(xiàng)目。本次我們將主要講述如何修改現(xiàn)有工程。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
BCGControlBar ("Business Components Gallery ControlBar")是MFC擴(kuò)展庫(kù),使您可以創(chuàng)建具有完全自定義選項(xiàng)(功能區(qū)、可自定義工具欄、菜單等)以及一組專業(yè)設(shè)計(jì)的豐富Microsoft Office和Microsoft Visual Studio的應(yīng)用程序 GUI控件,例如圖表、日歷、網(wǎng)格、編輯器、甘特圖和許多其他控件。
BCGControlBar Pro for MFC v30.6最新版下載
現(xiàn)有工程修改
在代碼中做以下更改
添加BCGCBPro 目錄到 包含目錄 和 庫(kù)目錄
在 stdafx.h文件中添加
#include "BCGCBProInc.h"
App類從CBCGPWinApp繼承。
class CMyApp: public CBCGPWinApp
在 APP 類的構(gòu)造函數(shù)中,指明通用配置選項(xiàng)
CBCGPToolbarOptions toolbarOptions; toolbarOptions.m_nViewToolbarsMenuEntryID = ID_VIEW_TOOLBAR; // Will be replaced with toolbars menu toolbarOptions.m_nCustomizeCommandID = ID_VIEW_CUSTOMIZE; // You don't need to add item to any toolbars/menus toolbarOptions.m_strCustomizeCommandLabel = _T("Customize..."); SetToolbarOptions(toolbarOptions);
確保在 InitInstance()調(diào)用了 CBCGPWinApp::InitInstance() 和 AfxOleInit()
下一步指明一個(gè)注冊(cè)表位置來存儲(chǔ)程序數(shù)據(jù)。在InitInstance()中指定一個(gè)注冊(cè)表?xiàng)l目(建議放到 LoadStdProfileSettings 后面)
例如:下面的代碼,存儲(chǔ)位置為HKEY_CURRENT_USER\SOFTWARE\MYAPP\應(yīng)用程序名稱\Settings
SetRegistryKey(_T("MYAPP")); LoadStdProfileSettings(); SetRegistryBase(_T("Settings"));
多文檔把mainframe.h mainframe.cpp中CMDIFrameWnd修改為CBCGPMDIFrameWnd 。多文檔把CFrameWnd修改為CBCGPFrameWnd 。
多文檔把CMDIChildWnd修改為CBCGPMDIChildWnd 。
把CToolbar修改為CBCGPToolBar ,并且在CMainFrame中嵌入一個(gè)實(shí)例。
CBCGPMenuBar m_wndMenuBar; // New menu bar CBCGPToolBar 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);2
注意:在程序中可以使用任意數(shù)量的 CBCGPToolBar。所有的 toolbar 圖片都會(huì)自動(dòng)合成為一個(gè)bitmap。但是CBCGPMenuBar只能有一個(gè)。
EnableUserTools(ID_TOOLS_ENTRY, ID_TOOL1, ID_TOOLx);
本文轉(zhuǎn)載自CSDN-
現(xiàn)購(gòu)買BCGSoft正版授權(quán)最高直降萬元,歡迎點(diǎn)擊了解產(chǎn)品正版授權(quán)>>
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn