[BCG]如何建立一个BCG属性页对话框
2016-04-27 16:39
375 查看
原创文章,欢迎转载。转载请注明:转载自 祥的博客
原文链接:/article/7763582.html
现在可以删除原来的继承Dialog的类文件
但是,
Page1.h 新加代码
Page1.cpp 新加代码
QFXMainPpSheet.h 新加代码
QFXMainPpSheet.cpp 新加代码
原文链接:/article/7763582.html
1. 新建BCG的Dialog项目
2. 添加一个继承CBCGPPropertySheet的类
3. 转换程序入口处将Dialog对象换成新建类对象
在入口程序的BOOL CQFX_BCGAppApp::InitInstance()中更改。
/* //原来的代码 CQFX_BCGAppDlg dlg; //原来的Dialog类对象 m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); */ //现在的代码 QFXMainPpSheet mainPpSheet; //现在的CBCGPPropertySheet类对象 m_pMainWnd = &mainPpSheet; INT_PTR nResponse = mainPpSheet.DoModal();
现在可以删除原来的继承Dialog的类文件
4. 设计Page页面
但是,
Page1这个类要继承于类
CBCGPPropertyPage,所以要修改 Page1.h 和 Page1.cpp。
Page1.h 新加代码
#pragma once #include "resource.h" // Page1 对话框 class Page1 : public CBCGPPropertyPage {//从CPropertyPage改为CBCGPPropertyPage DECLARE_DYNAMIC(Page1) public: Page1(); virtual ~Page1(); // 对话框数据 enum { IDD = IDD_PAGE1 }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 DECLARE_MESSAGE_MAP() };
Page1.cpp 新加代码
// Page1.cpp : 实现文件 // #include "stdafx.h" #include "QFX_BCGApp.h" #include "Page1.h" // Page1 对话框 IMPLEMENT_DYNAMIC(Page1, CBCGPPropertyPage) //从CPropertyPage改为CBCGPPropertyPage Page1::Page1() : CBCGPPropertyPage(Page1::IDD) {//从CPropertyPage改为CBCGPPropertyPage } Page1::~Page1() { } void Page1::DoDataExchange(CDataExchange* pDX) { //从CPropertyPage改为CBCGPPropertyPage CBCGPPropertyPage::DoDataExchange(pDX); } //从CPropertyPage改为CBCGPPropertyPage BEGIN_MESSAGE_MAP(Page1, CBCGPPropertyPage) END_MESSAGE_MAP() // Page1 消息处理程序
QFXMainPpSheet.h 新加代码
//作为主框架的类 #pragma once #include "bcgppropertysheet.h" #include "Page1.h"//new Add #include "Page2.h"//new Add class QFXMainPpSheet : public CBCGPPropertySheet { //DECLARE_DYNAMIC(QFXMainPpSheet)//new Add public: ~QFXMainPpSheet(void); QFXMainPpSheet(CWnd* pParentWnd = NULL);//new Add Page1 m_Page1;//new Add Page2 m_Page2;//new Add };
QFXMainPpSheet.cpp 新加代码
#include "StdAfx.h" #include "QFXMainPpSheet.h" QFXMainPpSheet::~QFXMainPpSheet(void) { } //new Add QFXMainPpSheet::QFXMainPpSheet( CWnd* pParentWnd /*= NULL*/ ) :CBCGPPropertySheet (IDS_CAPTION, pParentWnd)//new Add {// IDS_CAPTION 是窗口标题,是预先添加的资源类型 //这是改变BCG的皮肤,两者必须要同时使用,而且需要预先添加资源图片,这里是IDB_ICONS32 SetLook (CBCGPPropertySheet::PropSheetLook_OutlookBar);//new Add SetIconsList ( IDB_ICONS32, 32);//new Add AddPage(&m_Page1);//new Add AddPage(&m_Page2);//new Add }
5. 运行程序
6.程序框架
相关文章推荐
- centos 6.5+hadoop2.4.1环境配置
- 利用友盟定位iOS线上版本项目的崩溃位置
- 【单片机】[stm8] - 使用库函数时,减少ROM占用的方法
- Cocosd2d-js 数组使用
- hadoop经典wordcount和hdfs增加删除追加
- nodejs 模板 ejs helloworld
- 2011年山东ACM第二届省赛 Binomial Coeffcients(求组合数)
- .ashx接收APPCAN发送过来的图片数据流,保存为图片
- TDDL动态数据源开源-示例使用说明
- annovar对人类基因组和非人类基因组variants注释流程
- Java并发编程:如何创建线程?
- header函数运用
- HTML5——地图应用
- js execCommand
- poj3233 矩阵等比数列求和 二分
- Python之numpy
- mysql UTF-8 中文乱码问题
- Sa求法
- iOS如何获取手机的Mac地址
- [文档] TDDL和Diamond的使用(三):TDDL