-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettingDlg.cpp
71 lines (52 loc) · 1.32 KB
/
SettingDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// SettingDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "sweepMineMFC.h"
#include "SettingDlg.h"
// CSettingDlg 对话框
IMPLEMENT_DYNAMIC(CSettingDlg, CDialog)
CSettingDlg::CSettingDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSettingDlg::IDD, pParent),
m_size(0),
m_cnt(0)
{
}
CSettingDlg::~CSettingDlg()
{
}
void CSettingDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT_SIZE, m_size);
DDV_MinMaxUInt(pDX, m_size, 1, 17);
DDX_Text(pDX, IDC_EDIT_CNT, m_cnt);
DDV_MinMaxUInt(pDX, m_cnt, 0, 289);
}
BEGIN_MESSAGE_MAP(CSettingDlg, CDialog)
ON_BN_CLICKED(IDOK, &CSettingDlg::OnBnClickedOk)
ON_EN_CHANGE(IDC_EDIT_SIZE, &CSettingDlg::OnEnChangeEditSize)
END_MESSAGE_MAP()
// CSettingDlg 消息处理程序
void CSettingDlg::OnBnClickedOk()
{
// TODO: 在此添加控件通知处理程序代码
UpdateData(TRUE);
if (m_cnt > 289 || m_size > 17) {
return;
}
if (m_cnt > m_size * m_size) {
CString str;
str.Format("雷区:%d,地雷:%d,雷数量太多", m_size * m_size, m_cnt);
MessageBox(str);
return;
}
OnOK();
}
void CSettingDlg::OnEnChangeEditSize()
{
// TODO: 如果该控件是 RICHEDIT 控件,则它将不会
// 发送该通知,除非重写 CDialog::OnInitDialog()
// 函数并调用 CRichEditCtrl().SetEventMask(),
// 同时将 ENM_CHANGE 标志“或”运算到掩码中。
// TODO: 在此添加控件通知处理程序代码
}