inputmessage.cpp
来自「自己用MFC设计的N皇后问题演示程序」· C++ 代码 · 共 99 行
CPP
99 行
// InputMessage.cpp : implementation file
//
#include "stdafx.h"
#include "NQueen.h"
#include "InputMessage.h"
#include "NQueenDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// InputMessage dialog
InputMessage::InputMessage(CWnd* pParent /*=NULL*/)
: CDialog(InputMessage::IDD, pParent)
{
size="0";
//{{AFX_DATA_INIT(InputMessage)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void InputMessage::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(InputMessage)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(InputMessage, CDialog)
//{{AFX_MSG_MAP(InputMessage)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// InputMessage message handlers
void InputMessage::OnOK()
{
// TODO: Add extra validation here
size=GetInputStr();
int newn=atoi(size);
if(newn<=3) {
MessageBox("大小不能小于4,太小没必要", "警告", MB_OK);
return;
}
if(newn>15){
MessageBox("大小不能大于15,太大画不了", "警告", MB_OK);
return;
}
//GetDlgItem(IDC_QUEEN_SIZE)->SetWindowText(str);
CDialog::OnOK();
}
CString InputMessage::GetInputStr()
{
CString str;
GetDlgItem(IDC_EDIT)->GetWindowText(str);
return str;
}
//DEL BOOL InputMessage::PreCreateWindow(CREATESTRUCT& cs)
//DEL {
//DEL // TODO: Add your specialized code here and/or call the base class
//DEL
//DEL return CDialog::PreCreateWindow(cs);
//DEL }
BOOL InputMessage::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::Create(IDD, pParentWnd);
}
BOOL InputMessage::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
GetDlgItem(IDC_EDIT)->SetFocus();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?