?? parameter.cpp
字號:
// Parameter.cpp : 實現文件
//
#include "stdafx.h"
#include "AI.h"
#include "Parameter.h"
#include ".\parameter.h"
// CParameter 對話框
IMPLEMENT_DYNAMIC(CParameter, CDialog)
CParameter::CParameter(CWnd* pParent /*=NULL*/)
: CDialog(CParameter::IDD, pParent)
, her(1)
, sleep(500)
, maxstep(25)
{
}
CParameter::~CParameter()
{
}
void CParameter::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_HER, her);
DDX_Text(pDX, IDC_SLEEP, sleep);
DDX_Text(pDX, IDC_MAXSTEP, maxstep);
}
BEGIN_MESSAGE_MAP(CParameter, CDialog)
ON_BN_CLICKED(IDC_BUTTON_SET, OnBnClickedButtonSet)
END_MESSAGE_MAP()
// CParameter 消息處理程序
void CParameter::OnBnClickedButtonSet()
{
// TODO: 在此添加控件通知處理程序代碼
int tmp_her = her;
int tmp_sleep = sleep;
int tmp_maxstep = maxstep;
UpdateData();
CString str;
if(sleep < 200 || sleep > 2000){
str += "演示延遲時間必須在200~2000ms之間。";
SetDlgItemInt(IDC_SLEEP, tmp_sleep);
}
if(her < 0 || her > 100){
if(str != "")
str += "\r\n";
str += "啟發函數h(x)的系數必須在0~100之間。";
SetDlgItemInt(IDC_HER, tmp_her);
}
if(maxstep < 5 || maxstep > 50){
if(str != "")
str += "\r\n";
str += "深度優先的界限必須在5~50之間。";
SetDlgItemInt(IDC_MAXSTEP, tmp_maxstep);
}
if(str != ""){
UpdateData();
MessageBox(str, "錯誤");
}else
EndDialog(1000);
}
void CParameter::GetParameter(int & m_her, int & m_sleep, int & m_maxstep)
{
m_her = her;
m_sleep = sleep;
m_maxstep = maxstep;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -