请问 CPropertyPage是什么意思?

lanhuo6 2004-08-17 02:54:52
程序中有一句:public CPropertyPage
请问CPropertyPage是什么意思,干什么用的?
...全文
205 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
readi 2004-08-17
  • 打赏
  • 举报
回复
上面是我自己程序里的两个文件,关于CPropertyPage和CPropertySheet,你可以参照着MSDN看一看,若有bug,一定要告诉我哦:)
readi 2004-08-17
  • 打赏
  • 举报
回复
.cpp文件
#include "property.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPage property page

IMPLEMENT_DYNCREATE(CPage, CPropertyPage)

CPage::CPage() : CPropertyPage(CPage::IDD)
{
//{{AFX_DATA_INIT(CPage)
m_iPcl = 0;
m_iChannel = 0;
m_strCustomCh = _T("");
m_strCustomPcl = _T("");
m_fPower = 0.0f;
m_fCableLoss = 0.0f;
for(int i = 0; i < iITEM_NUM; i++)
{
m_bItem[i] = FALSE;
}
//}}AFX_DATA_INIT
}

CPage::CPage(UINT nIDCaption) : CPropertyPage(CPage::IDD, nIDCaption)
{
//{{AFX_DATA_INIT(CPage)
m_iPcl = 0;
m_iChannel = 0;
m_strCustomCh = _T("");
m_strCustomPcl = _T("");
m_fPower = 0.0f;
m_fCableLoss = 0.0f;
for(int i = 0; i < iITEM_NUM; i++)
{
m_bItem[i] = FALSE;
}
//}}AFX_DATA_INIT}
}

CPage::~CPage()
{
}

void CPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPage)
DDX_Radio(pDX, IDC_PCL, m_iPcl);
DDX_Radio(pDX, IDC_CHANNEL, m_iChannel);
DDX_Text(pDX, IDC_CUSTOM_CH, m_strCustomCh);
DDX_Text(pDX, IDC_CUSTOM_PCL, m_strCustomPcl);
DDX_Text(pDX, IDC_POWER, m_fPower);
DDX_Text(pDX, IDC_CABLE_LOSS, m_fCableLoss);
DDX_Check(pDX, IDC_CHECK1, m_bItem[0]);
DDX_Check(pDX, IDC_CHECK2, m_bItem[1]);
for(int i = 0; i < iITEM_NUM; i++)
{
DDX_Check(pDX, IDC_CHECK1+i, m_bItem[0]);
}
//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPage, CPropertyPage)
//{{AFX_MSG_MAP(CPage)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPage message handlers
/////////////////////////////////////////////////////////////////////////////
// CTestSheet

IMPLEMENT_DYNAMIC(CTestSheet, CPropertySheet)

CTestSheet::CTestSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
}

CTestSheet::CTestSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
m_Page[GSM] = new CPage(IDS_PAGE_GSM);
m_Page[DCS] = new CPage(IDS_PAGE_DCS);
m_Page[PCS] = new CPage(IDS_PAGE_PCS);
AddPage(m_Page[GSM]);
AddPage(m_Page[DCS]);
AddPage(m_Page[PCS]);
}

CTestSheet::~CTestSheet()
{
delete m_Page[GSM];
delete m_Page[DCS];
delete m_Page[PCS];
}


BEGIN_MESSAGE_MAP(CTestSheet, CPropertySheet)
//{{AFX_MSG_MAP(CTestSheet)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTestSheet message handlers
lanhuo6 2004-08-17
  • 打赏
  • 举报
回复
楼上的哥哥,能说详细点吗,小弟初学vc,谢谢!!!
readi 2004-08-17
  • 打赏
  • 举报
回复
.h文件
#if !defined(AFX_PROPERTY_H__1C4800A3_5759_4D80_9140_CC9A15A1796D__INCLUDED_)
#define AFX_PROPERTY_H__1C4800A3_5759_4D80_9140_CC9A15A1796D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// property.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CPage dialog
#include "Test Module\TestItem.h"

const int iITEM_NUM = 10;

class CPage : public CPropertyPage
{
DECLARE_DYNCREATE(CPage)

// Construction
public:
CPage(UINT nIDCaption);
CPage();
~CPage();

// Dialog Data
//{{AFX_DATA(CPage)
enum { IDD = IDD_PROPPAGE_LARGE };
int m_iPcl;
int m_iChannel;
CString m_strCustomCh;
CString m_strCustomPcl;
float m_fPower;
float m_fCableLoss;
BOOL m_bItem[iITEM_NUM];
//}}AFX_DATA


// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CPage)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL

// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CPage)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()

};

/////////////////////////////////////////////////////////////////////////////
// CTestSheet

class CTestSheet : public CPropertySheet
{
DECLARE_DYNAMIC(CTestSheet)

// Construction
public:
CTestSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
CTestSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);

// Attributes
public:

// Operations
public:

// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTestSheet)
//}}AFX_VIRTUAL

// Implementation
public:
CPage* m_Page[TOTAL_BAND];
virtual ~CTestSheet();

// Generated message map functions
protected:
//{{AFX_MSG(CTestSheet)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_PROPERTY_H__1C4800A3_5759_4D80_9140_CC9A15A1796D__INCLUDED_)
readi 2004-08-17
  • 打赏
  • 举报
回复
是MFC中的一个类,用来做tab窗口的一个属性页的

16,548

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • AIGC Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧