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

📄 modaldlg.cpp

📁 姚领田编著《精通MFC程序设计》一书的随书源码
💻 CPP
字号:
// ModalDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Chapter08.h"
#include "ModalDlg.h"
#include "MainFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CModalDlg dialog


CModalDlg::CModalDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CModalDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CModalDlg)
	m_strTittle = _T("");
	m_iThick = 0;
	m_Radius = 0;
	//}}AFX_DATA_INIT
}


void CModalDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CModalDlg)
	DDX_Text(pDX, IDC_TITTLE, m_strTittle);
	DDV_MaxChars(pDX, m_strTittle, 10);
	DDX_Text(pDX, IDC_THICK, m_iThick);
	DDX_Text(pDX, IDC_RADIUS, m_Radius);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CModalDlg, CDialog)
	//{{AFX_MSG_MAP(CModalDlg)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON_COLOR, OnButtonColor)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CModalDlg message handlers


void CModalDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
	GetParent()->EnableWindow(1);
}

void CModalDlg::OnOK() 
{
	// TODO: Add extra validation here
	
	CDialog::OnOK();
}

void CModalDlg::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	CDialog::OnCancel();
}

BOOL CModalDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CModalDlg::OnButtonColor() 
{
	// TODO: Add your control notification handler code here
//	CMainFrame* pMain=(CMainFrame*)AfxGetMainWnd();
	CColorDialog colordlg;
	if(colordlg.DoModal()==IDOK)
	{
		

	}
//	pMain->SetWindowText(m_strTittle);
}

⌨️ 快捷键说明

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