setdlg.cpp

来自「小灵通基站异常仿真」· C++ 代码 · 共 94 行

CPP
94
字号
// SetDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Test.h"
#include "SetDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSetDlg dialog
int CSetDlg::savepoint=1000;


CSetDlg::CSetDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSetDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSetDlg)
	m_iPoint = 0;
	//}}AFX_DATA_INIT
}


void CSetDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSetDlg)
	DDX_Text(pDX, IDC_POINT, m_iPoint);
	DDV_MinMaxInt(pDX, m_iPoint, 1, 1000);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSetDlg, CDialog)
	//{{AFX_MSG_MAP(CSetDlg)
	ON_BN_CLICKED(IDC_DEFAULT, OnDefault)
	ON_BN_CLICKED(ID_SET, OnSet)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSetDlg message handlers

BOOL CSetDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_iPoint=savepoint;
	UpdateData(false);
//	AfxMessageBox("haha");
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSetDlg::OnDefault() 
{
	// TODO: Add your control notification handler code here
	m_iPoint=1000;
	UpdateData(false);
	
}

void CSetDlg::OnSet() 
{
	// TODO: Add your control notification handler code here
	UpdateData(true);
	savepoint=m_iPoint;
	if(savepoint%40!=0)
		AfxMessageBox("请输入40的倍数");
	else
		OnOK();

	
}


void CSetDlg::Serialize(CArchive& ar) 
{
	if (ar.IsStoring())
	{
		ar<<savepoint;
	}
	else
	{	// loading code
		ar>>savepoint;
	}
}

⌨️ 快捷键说明

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