customdlg.cpp

来自「WINDOWS CE系统下EVC开发的扫雷源码,很经典,值得下载」· C++ 代码 · 共 59 行

CPP
59
字号
// CustomDlg.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "CustomDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCustomDlg dialog


CCustomDlg::CCustomDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCustomDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCustomDlg)
	m_height = 0;
	m_mines = 0;
	m_width = 0;
	//}}AFX_DATA_INIT
}


void CCustomDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCustomDlg)
	DDX_Text(pDX, IDC_HEIGHT, m_height);
	DDX_Text(pDX, IDC_MINES, m_mines);
	DDX_Text(pDX, IDC_WIDTH, m_width);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCustomDlg, CDialog)
	//{{AFX_MSG_MAP(CCustomDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCustomDlg message handlers

void CCustomDlg::OnOK() 
{
	CDialog::OnOK();
	
	if( m_width > 30 )
		m_width = 30;
	if( m_height > 24 )
		m_height = 24;
	int max = m_width * m_height * 4 / 5;		// 80%
	if( m_mines > max )
		m_mines = max;
}

⌨️ 快捷键说明

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