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

📄 paradlg.cpp

📁 汉诺塔的实现
💻 CPP
字号:
// ParaDlg.cpp : implementation file
//

#include "stdafx.h"
#include "HanoiTower.h"
#include "ParaDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// ParaDlg dialog


ParaDlg::ParaDlg(CWnd* pParent /*=NULL*/)
	: CDialog(ParaDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(ParaDlg)
	m_nDiscNum = 0;
	m_strSpeed = _T("");
	m_nIsAuto = -1;
	//}}AFX_DATA_INIT
}


void ParaDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(ParaDlg)
	DDX_Text(pDX, IDC_EDIT_DISCNUM, m_nDiscNum);
	DDV_MinMaxInt(pDX, m_nDiscNum, 1, 9);
	DDX_CBString(pDX, IDC_LIST_SPEED, m_strSpeed);
	DDX_Radio(pDX, IDC_RADIO_AUTO, m_nIsAuto);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(ParaDlg, CDialog)
	//{{AFX_MSG_MAP(ParaDlg)
	ON_CBN_EDITCHANGE(IDC_LIST_SPEED, OnEditChangeDelay)
	ON_BN_CLICKED(IDC_DEFAULT, OnDefault)
	ON_BN_CLICKED(IDC_OK, OnClickOk)
	ON_BN_CLICKED(IDC_CANCEL, OnClickCancel)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// ParaDlg message handlers

void ParaDlg::OnEditChangeDelay() 
{
	// TODO: Add your control notification handler code here
    if (m_strSpeed=="高速")
	{
		m_nDelay=10;
	}
	else if (m_strSpeed=="中速")
	{
		m_nDelay=500;
	}
	else if (m_strSpeed=="低速")
	{
		m_nDelay=1000;
	}
	else
	{
		AfxMessageBox("速度选择不正确,采用默认值(中速),要修改请从新选择", 
			          MB_OK);
		m_nDelay=500;
	}

}

BOOL ParaDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
//注销掉,这样在显示的时候就不会总用一个值 
/*	m_nDiscNum=5;
	m_nIsAuto=0;         //自动演示模式
	m_strSpeed="中速";
	UpdateData(FALSE); */
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}



void ParaDlg::OnDefault() 
{
	// TODO: Add your control notification handler code here
	m_nDiscNum=5;
	m_nIsAuto=0;
	m_strSpeed="中速";
	UpdateData(FALSE);
}

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

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

void ParaDlg::OnClickOk() 
{
	// TODO: Add your control notification handler code here
	
	CDialog::OnOK();
}

void ParaDlg::OnClickCancel() 
{
	// TODO: Add your control notification handler code here
	CDialog::OnCancel();
}

⌨️ 快捷键说明

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