⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 colorpage.cpp

📁 VC++6开发指南的源代码第7章-第11章
💻 CPP
字号:
// ColorPage.cpp : implementation file
//

#include "stdafx.h"
#include "TabDlgDemo.h"
#include "ColorPage.h"
#include "MainFrm.h"
#include "MyPropertySheet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CColorPage property page

IMPLEMENT_DYNCREATE(CColorPage, CPropertyPage)

CColorPage::CColorPage() : CPropertyPage(CColorPage::IDD)
{
	//{{AFX_DATA_INIT(CColorPage)
	m_r = 0;
	m_g = 0;
	m_b = 0;
	m_radio = 0;
	//}}AFX_DATA_INIT
}

CColorPage::~CColorPage()
{
}

void CColorPage::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CColorPage)
	DDX_Text(pDX, IDC_EDIT1, m_r);
	DDV_MinMaxInt(pDX, m_r, 0, 255);
	DDX_Text(pDX, IDC_EDIT2, m_g);
	DDV_MinMaxInt(pDX, m_g, 0, 255);
	DDX_Text(pDX, IDC_EDIT3, m_b);
	DDV_MinMaxInt(pDX, m_b, 0, 255);
	DDX_Radio(pDX, IDC_RADIO1, m_radio);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CColorPage, CPropertyPage)
	//{{AFX_MSG_MAP(CColorPage)
	ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
	ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
	ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
	ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CColorPage message handlers

BOOL CColorPage::OnApply() 
{
	// TODO: Add your specialized code here and/or call the base class
	CMainFrame* pMFrm=(CMainFrame*)AfxGetMainWnd();
	//向视图类发送用户自定义消息
	pMFrm->GetActiveView()->SendMessage(WM_USER_APPLY);
	//return TRUE;
	//
	return CPropertyPage::OnApply();
}

void CColorPage::OnRadio1() 
{
	// TODO: Add your control notification handler code here
	SetModified();//激活应用按钮
	m_radio = 0;
	GetDlgItem(IDC_EDIT1)->EnableWindow(false);					//颜色编辑框禁止输入
	GetDlgItem(IDC_EDIT2)->EnableWindow(false);
	GetDlgItem(IDC_EDIT3)->EnableWindow(false);
}

void CColorPage::OnRadio2() 
{
	// TODO: Add your control notification handler code here
	SetModified();//激活应用按钮
	m_radio = 1;
	GetDlgItem(IDC_EDIT1)->EnableWindow(false);					//颜色编辑框禁止输入
	GetDlgItem(IDC_EDIT2)->EnableWindow(false);
	GetDlgItem(IDC_EDIT3)->EnableWindow(false);	

	
}

void CColorPage::OnRadio3() 
{
	// TODO: Add your control notification handler code here
	SetModified();//激活应用按钮
	m_radio = 2;
	GetDlgItem(IDC_EDIT1)->EnableWindow(false);					//颜色编辑框禁止输入
	GetDlgItem(IDC_EDIT2)->EnableWindow(false);
	GetDlgItem(IDC_EDIT3)->EnableWindow(false);

	
}

void CColorPage::OnRadio4() 
{
	// TODO: Add your control notification handler code here
	SetModified();//激活应用按钮
	m_radio = 3;
	GetDlgItem(IDC_EDIT1)->EnableWindow(true);					//颜色编辑框允许输入
	GetDlgItem(IDC_EDIT2)->EnableWindow(true);
	GetDlgItem(IDC_EDIT3)->EnableWindow(true);

	
}

BOOL CColorPage::OnInitDialog() 
{
	CPropertyPage::OnInitDialog();
	// TODO: Add extra initialization here
	GetDlgItem(IDC_EDIT1)->EnableWindow(false);					//颜色编辑框禁止输入
	GetDlgItem(IDC_EDIT2)->EnableWindow(false);
	GetDlgItem(IDC_EDIT3)->EnableWindow(false);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

BOOL CColorPage::OnSetActive() 
{
	// TODO: Add your specialized code here and/or call the base class
	CMyPropertySheet* p=(CMyPropertySheet*)GetParent();
	//对于第一页,仅启用"下一步"按钮
	p->SetWizardButtons(PSWIZB_NEXT);
	return CPropertyPage::OnSetActive();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -