www.pudn.com > IE_Style_Wizard.rar > Page1.cpp
// Page1.cpp : implementation file
//
#include "stdafx.h"
#include "IE_Style_Wizard.h"
#include "Page1.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPage1 property page
IMPLEMENT_DYNCREATE(CPage1, CPropertyPage)
CPage1::CPage1() : CPropertyPage(CPage1::IDD)
{
//{{AFX_DATA_INIT(CPage1)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CPage1::~CPage1()
{
}
void CPage1::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPage1)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPage1, CPropertyPage)
//{{AFX_MSG_MAP(CPage1)
ON_WM_ERASEBKGND()
ON_WM_CTLCOLOR()
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPage1 message handlers
BOOL CPage1::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
// pDC->SetBkMode(TRANSPARENT );
return CPropertyPage::OnEraseBkgnd(pDC);
}
HBRUSH CPage1::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
//让页面的文本与控件以透明方式显示
pDC->SetBkMode(TRANSPARENT);
//将整个页面的背景色设置成白色
hbr= CreateSolidBrush(RGB(255,255,255));
return hbr;
}
BOOL CPage1::OnSetActive()
{
CRect rc,p;
this->GetClientRect(&rc);
this->GetParent()->GetClientRect(&p);
//求出对话框与属性页窗口的位置差
int diff=p.bottom-rc.bottom;
//将页面向左上方靠,与父窗口的位置一样
rc.SetRect(0,
0,
p.Width(),
p.Height()-diff);
//-diff:让属性页的按钮有空间显示
MoveWindow(&rc);
return CPropertyPage::OnSetActive();
}
void CPage1::OnRadio2()
{
AfxMessageBox("你选择了按钮");
}