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