前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >[BCG]如何建立一个BCG属性页对话框

[BCG]如何建立一个BCG属性页对话框

作者头像
祥知道
发布2020-03-10 15:10:35
6310
发布2020-03-10 15:10:35
举报
文章被收录于专栏:祥的专栏祥的专栏

原创文章,欢迎转载。转载请注明:转载自 祥的博客

原文链接:http://blog.csdn.net/humanking7/article/details/51262287


1. 新建BCG的Dialog项目

这里写图片描述
这里写图片描述

2. 添加一个继承CBCGPPropertySheet的类

这里写图片描述
这里写图片描述

3. 转换程序入口处将Dialog对象换成新建类对象

在入口程序的 BOOL CQFX_BCGAppApp::InitInstance() 中更改。

代码语言:javascript
复制
/* 
//原来的代码
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.hPage1.cpp

Page1.h 新加代码

代码语言:javascript
复制
#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 新加代码

代码语言:javascript
复制
// 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 新加代码

代码语言:javascript
复制
//作为主框架的类
#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 新加代码

代码语言:javascript
复制
#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.程序框架

这里写图片描述
这里写图片描述

Next····

接着请看[BCG]属性页对话框删除”上一步”…”帮助”等4个按钮

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1. 新建BCG的Dialog项目
  • 2. 添加一个继承CBCGPPropertySheet的类
  • 3. 转换程序入口处将Dialog对象换成新建类对象
  • 4. 设计Page页面
  • 5. 运行程序
  • 6.程序框架
  • Next····
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档