📄 enterview.cpp
字号:
// EnterView.cpp : implementation file
//
#include "stdafx.h"
#include "Chess.h"
#include "EnterView.h"
#include "ChessDoc.h"
#include "ctype.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEnterView
IMPLEMENT_DYNCREATE(CEnterView, CFormView)
CEnterView::CEnterView()
: CFormView(CEnterView::IDD)
{
//AfxMessageBox("CEnterView");
//CChessDoc *pDoc=(CChessDoc*)GetDocument();
//if(pDoc->m_bFileOpen)
// return;
m_N=3;
m_NUM=9;
//UpdateData(FALSE);
//{{AFX_DATA_INIT(CEnterView)
m_strEnd44_0 = _T("F");
m_strEnd44_1 = _T("E");
m_strEnd44_2 = _T("D");
m_strEnd44_3 = _T("C");
m_strEnd44_4 = _T("B");
m_strEnd44_5 = _T("A");
m_strEnd44_6 = _T("9");
m_strEnd44_7 = _T("8");
m_strEnd44_8 = _T("7");
m_strEnd44_9 = _T("6");
m_strEnd44_A = _T("5");
m_strEnd44_B = _T("0");
m_strEnd44_C = _T("3");
m_strEnd44_D = _T("2");
m_strEnd44_E = _T("1");
m_strEnd44_F = _T("4");
m_strStart44_0 = _T("F");
m_strStart44_2 = _T("D");
m_strStart44_3 = _T("C");
m_strStart44_4 = _T("B");
m_strStart44_5 = _T("A");
m_strStart44_6 = _T("9");
m_strStart44_7 = _T("8");
m_strStart44_8 = _T("7");
m_strStart44_9 = _T("6");
m_strStart44_B = _T("4");
m_strStart44_C = _T("3");
m_strStart44_A = _T("5");
m_strStart44_D = _T("2");
m_strStart44_E = _T("1");
m_strStart44_F = _T("0");
m_strStart44_1 = _T("E");
m_nType = 1;
m_strEnd33_0 = _T("1");
m_strEnd33_1 = _T("2");
m_strEnd33_2 = _T("3");
m_strEnd33_3 = _T("8");
m_strEnd33_4 = _T("0");
m_strEnd33_5 = _T("4");
m_strEnd33_6 = _T("7");
m_strEnd33_7 = _T("6");
m_strEnd33_8 = _T("5");
m_strStart33_0 = _T("2");
m_strStart33_1 = _T("8");
m_strStart33_2 = _T("3");
m_strStart33_3 = _T("1");
m_strStart33_4 = _T("6");
m_strStart33_5 = _T("4");
m_strStart33_6 = _T("7");
m_strStart33_7 = _T("0");
m_strStart33_8 = _T("5");
m_nScale = 0;
m_nDepth = 1000;
//}}AFX_DATA_INIT
}
CEnterView::~CEnterView()
{
}
void CEnterView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CEnterView)
DDX_Control(pDX, IDC_EDIT_END_33_1, m_gridEnd33_1);
DDX_Control(pDX, IDC_EDIT_END_33_0, m_gridEnd33_0);
DDX_Control(pDX, IDC_EDIT_END_33_2, m_gridEnd33_2);
DDX_Control(pDX, IDC_EDIT_END_33_3, m_gridEnd33_3);
DDX_Control(pDX, IDC_EDIT_END_33_4, m_gridEnd33_4);
DDX_Control(pDX, IDC_EDIT_END_33_5, m_gridEnd33_5);
DDX_Control(pDX, IDC_EDIT_END_33_6, m_gridEnd33_6);
DDX_Control(pDX, IDC_EDIT_END_33_7, m_gridEnd33_7);
DDX_Control(pDX, IDC_EDIT_END_33_8, m_gridEnd33_8);
DDX_Control(pDX, IDC_EDIT_START_33_0, m_gridStart33_0);
DDX_Control(pDX, IDC_EDIT_START_33_1, m_gridStart33_1);
DDX_Control(pDX, IDC_EDIT_START_33_2, m_gridStart33_2);
DDX_Control(pDX, IDC_EDIT_START_33_3, m_gridStart33_3);
DDX_Control(pDX, IDC_EDIT_START_33_4, m_gridStart33_4);
DDX_Control(pDX, IDC_EDIT_START_33_5, m_gridStart33_5);
DDX_Control(pDX, IDC_EDIT_START_33_6, m_gridStart33_6);
DDX_Control(pDX, IDC_EDIT_START_33_7, m_gridStart33_7);
DDX_Control(pDX, IDC_EDIT_START_33_8, m_gridStart33_8);
DDX_Control(pDX, IDC_COMBO_TYPE, m_cboType);
DDX_Control(pDX, IDC_EDIT_STARTF, m_gridStart44_F);
DDX_Control(pDX, IDC_EDIT_STARTE, m_gridStart44_E);
DDX_Control(pDX, IDC_EDIT_STARTD, m_gridStart44_D);
DDX_Control(pDX, IDC_EDIT_STARTC, m_gridStart44_C);
DDX_Control(pDX, IDC_EDIT_STARTB, m_gridStart44_B);
DDX_Control(pDX, IDC_EDIT_STARTA, m_gridStart44_A);
DDX_Control(pDX, IDC_EDIT_START9, m_gridStart44_9);
DDX_Control(pDX, IDC_EDIT_START8, m_gridStart44_8);
DDX_Control(pDX, IDC_EDIT_START7, m_gridStart44_7);
DDX_Control(pDX, IDC_EDIT_START6, m_gridStart44_6);
DDX_Control(pDX, IDC_EDIT_START5, m_gridStart44_5);
DDX_Control(pDX, IDC_EDIT_START4, m_gridStart44_4);
DDX_Control(pDX, IDC_EDIT_START3, m_gridStart44_3);
DDX_Control(pDX, IDC_EDIT_START2, m_gridStart44_2);
DDX_Control(pDX, IDC_EDIT_START1, m_gridStart44_1);
DDX_Control(pDX, IDC_EDIT_START0, m_gridStart44_0);
DDX_Control(pDX, IDC_EDIT_ENDF, m_gridEnd44_F);
DDX_Control(pDX, IDC_EDIT_ENDE, m_gridEnd44_E);
DDX_Control(pDX, IDC_EDIT_ENDD, m_gridEnd44_D);
DDX_Control(pDX, IDC_EDIT_ENDC, m_gridEnd44_C);
DDX_Control(pDX, IDC_EDIT_ENDB, m_gridEnd44_B);
DDX_Control(pDX, IDC_EDIT_ENDA, m_gridEnd44_A);
DDX_Control(pDX, IDC_EDIT_END9, m_gridEnd44_9);
DDX_Control(pDX, IDC_EDIT_END7, m_gridEnd44_7);
DDX_Control(pDX, IDC_EDIT_END8, m_gridEnd44_8);
DDX_Control(pDX, IDC_EDIT_END6, m_gridEnd44_6);
DDX_Control(pDX, IDC_EDIT_END5, m_gridEnd44_5);
DDX_Control(pDX, IDC_EDIT_END4, m_gridEnd44_4);
DDX_Control(pDX, IDC_EDIT_END3, m_gridEnd44_3);
DDX_Control(pDX, IDC_EDIT_END2, m_gridEnd44_2);
DDX_Control(pDX, IDC_EDIT_END1, m_gridEnd44_1);
DDX_Control(pDX, IDC_EDIT_END0, m_gridEnd44_0);
DDX_Text(pDX, IDC_EDIT_END0, m_strEnd44_0);
DDV_MaxChars(pDX, m_strEnd44_0, 1);
DDX_Text(pDX, IDC_EDIT_END1, m_strEnd44_1);
DDV_MaxChars(pDX, m_strEnd44_1, 1);
DDX_Text(pDX, IDC_EDIT_END2, m_strEnd44_2);
DDV_MaxChars(pDX, m_strEnd44_2, 1);
DDX_Text(pDX, IDC_EDIT_END3, m_strEnd44_3);
DDV_MaxChars(pDX, m_strEnd44_3, 1);
DDX_Text(pDX, IDC_EDIT_END4, m_strEnd44_4);
DDV_MaxChars(pDX, m_strEnd44_4, 1);
DDX_Text(pDX, IDC_EDIT_END5, m_strEnd44_5);
DDV_MaxChars(pDX, m_strEnd44_5, 1);
DDX_Text(pDX, IDC_EDIT_END6, m_strEnd44_6);
DDV_MaxChars(pDX, m_strEnd44_6, 1);
DDX_Text(pDX, IDC_EDIT_END7, m_strEnd44_7);
DDV_MaxChars(pDX, m_strEnd44_7, 1);
DDX_Text(pDX, IDC_EDIT_END8, m_strEnd44_8);
DDV_MaxChars(pDX, m_strEnd44_8, 1);
DDX_Text(pDX, IDC_EDIT_END9, m_strEnd44_9);
DDV_MaxChars(pDX, m_strEnd44_9, 1);
DDX_Text(pDX, IDC_EDIT_ENDA, m_strEnd44_A);
DDV_MaxChars(pDX, m_strEnd44_A, 1);
DDX_Text(pDX, IDC_EDIT_ENDB, m_strEnd44_B);
DDV_MaxChars(pDX, m_strEnd44_B, 1);
DDX_Text(pDX, IDC_EDIT_ENDC, m_strEnd44_C);
DDV_MaxChars(pDX, m_strEnd44_C, 1);
DDX_Text(pDX, IDC_EDIT_ENDD, m_strEnd44_D);
DDV_MaxChars(pDX, m_strEnd44_D, 1);
DDX_Text(pDX, IDC_EDIT_ENDE, m_strEnd44_E);
DDV_MaxChars(pDX, m_strEnd44_E, 1);
DDX_Text(pDX, IDC_EDIT_ENDF, m_strEnd44_F);
DDV_MaxChars(pDX, m_strEnd44_F, 1);
DDX_Text(pDX, IDC_EDIT_START0, m_strStart44_0);
DDV_MaxChars(pDX, m_strStart44_0, 1);
DDX_Text(pDX, IDC_EDIT_START2, m_strStart44_2);
DDV_MaxChars(pDX, m_strStart44_2, 1);
DDX_Text(pDX, IDC_EDIT_START3, m_strStart44_3);
DDV_MaxChars(pDX, m_strStart44_3, 1);
DDX_Text(pDX, IDC_EDIT_START4, m_strStart44_4);
DDV_MaxChars(pDX, m_strStart44_4, 1);
DDX_Text(pDX, IDC_EDIT_START5, m_strStart44_5);
DDV_MaxChars(pDX, m_strStart44_5, 1);
DDX_Text(pDX, IDC_EDIT_START6, m_strStart44_6);
DDV_MaxChars(pDX, m_strStart44_6, 1);
DDX_Text(pDX, IDC_EDIT_START7, m_strStart44_7);
DDV_MaxChars(pDX, m_strStart44_7, 1);
DDX_Text(pDX, IDC_EDIT_START8, m_strStart44_8);
DDV_MaxChars(pDX, m_strStart44_8, 1);
DDX_Text(pDX, IDC_EDIT_START9, m_strStart44_9);
DDV_MaxChars(pDX, m_strStart44_9, 1);
DDX_Text(pDX, IDC_EDIT_STARTB, m_strStart44_B);
DDV_MaxChars(pDX, m_strStart44_B, 1);
DDX_Text(pDX, IDC_EDIT_STARTC, m_strStart44_C);
DDV_MaxChars(pDX, m_strStart44_C, 1);
DDX_Text(pDX, IDC_EDIT_STARTA, m_strStart44_A);
DDV_MaxChars(pDX, m_strStart44_A, 1);
DDX_Text(pDX, IDC_EDIT_STARTD, m_strStart44_D);
DDV_MaxChars(pDX, m_strStart44_D, 1);
DDX_Text(pDX, IDC_EDIT_STARTE, m_strStart44_E);
DDV_MaxChars(pDX, m_strStart44_E, 1);
DDX_Text(pDX, IDC_EDIT_STARTF, m_strStart44_F);
DDV_MaxChars(pDX, m_strStart44_F, 1);
DDX_Text(pDX, IDC_EDIT_START1, m_strStart44_1);
DDV_MaxChars(pDX, m_strStart44_1, 1);
DDX_CBIndex(pDX, IDC_COMBO_TYPE, m_nType);
DDX_Text(pDX, IDC_EDIT_END_33_0, m_strEnd33_0);
DDV_MaxChars(pDX, m_strEnd33_0, 1);
DDX_Text(pDX, IDC_EDIT_END_33_1, m_strEnd33_1);
DDV_MaxChars(pDX, m_strEnd33_1, 1);
DDX_Text(pDX, IDC_EDIT_END_33_2, m_strEnd33_2);
DDV_MaxChars(pDX, m_strEnd33_2, 1);
DDX_Text(pDX, IDC_EDIT_END_33_3, m_strEnd33_3);
DDV_MaxChars(pDX, m_strEnd33_3, 1);
DDX_Text(pDX, IDC_EDIT_END_33_4, m_strEnd33_4);
DDV_MaxChars(pDX, m_strEnd33_4, 1);
DDX_Text(pDX, IDC_EDIT_END_33_5, m_strEnd33_5);
DDV_MaxChars(pDX, m_strEnd33_5, 1);
DDX_Text(pDX, IDC_EDIT_END_33_6, m_strEnd33_6);
DDV_MaxChars(pDX, m_strEnd33_6, 1);
DDX_Text(pDX, IDC_EDIT_END_33_7, m_strEnd33_7);
DDV_MaxChars(pDX, m_strEnd33_7, 1);
DDX_Text(pDX, IDC_EDIT_END_33_8, m_strEnd33_8);
DDV_MaxChars(pDX, m_strEnd33_8, 1);
DDX_Text(pDX, IDC_EDIT_START_33_0, m_strStart33_0);
DDV_MaxChars(pDX, m_strStart33_0, 1);
DDX_Text(pDX, IDC_EDIT_START_33_1, m_strStart33_1);
DDV_MaxChars(pDX, m_strStart33_1, 1);
DDX_Text(pDX, IDC_EDIT_START_33_2, m_strStart33_2);
DDV_MaxChars(pDX, m_strStart33_2, 1);
DDX_Text(pDX, IDC_EDIT_START_33_3, m_strStart33_3);
DDV_MaxChars(pDX, m_strStart33_3, 1);
DDX_Text(pDX, IDC_EDIT_START_33_4, m_strStart33_4);
DDV_MaxChars(pDX, m_strStart33_4, 1);
DDX_Text(pDX, IDC_EDIT_START_33_5, m_strStart33_5);
DDV_MaxChars(pDX, m_strStart33_5, 1);
DDX_Text(pDX, IDC_EDIT_START_33_6, m_strStart33_6);
DDV_MaxChars(pDX, m_strStart33_6, 1);
DDX_Text(pDX, IDC_EDIT_START_33_7, m_strStart33_7);
DDV_MaxChars(pDX, m_strStart33_7, 1);
DDX_Text(pDX, IDC_EDIT_START_33_8, m_strStart33_8);
DDV_MaxChars(pDX, m_strStart33_8, 1);
DDX_Radio(pDX, IDC_RADIO_TYPE33, m_nScale);
DDX_Text(pDX, IDC_EDIT_DEPTH, m_nDepth);
DDV_MinMaxUInt(pDX, m_nDepth, 0, 32767);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CEnterView, CFormView)
//{{AFX_MSG_MAP(CEnterView)
ON_BN_CLICKED(IDC_BUTTON_BEGIN, OnButtonBegin)
ON_CBN_SELCHANGE(IDC_COMBO_TYPE, OnSelchangeComboType)
ON_BN_CLICKED(IDC_RADIO_TYPE33, OnRadioType33)
ON_BN_CLICKED(IDC_RADIO_TYPE44, OnRadioType44)
ON_EN_CHANGE(IDC_EDIT_DEPTH, OnChangeEditDepth)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEnterView diagnostics
#ifdef _DEBUG
void CEnterView::AssertValid() const
{
CFormView::AssertValid();
}
void CEnterView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEnterView message handlers
//DEL void CEnterView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
//DEL {
//DEL // TODO: Add your message handler code here and/or call default
//DEL AfxMessageBox("aaa");
//DEL //CFormView::OnChar(nChar, nRepCnt, nFlags);
//DEL }
void CEnterView::OnButtonBegin()
{
int i;
unsigned char buf[15];
CString tempChar;
CChessDoc* pDoc=(CChessDoc*)GetDocument();
CEdit *pEdit;
UpdateData();
for(i=0;i<m_NUM;i++)
{
if(m_N==3)
pEdit=(CEdit*)GetDlgItem(IDC_EDIT_START_33_0+i);
else
pEdit=(CEdit*)GetDlgItem(IDC_EDIT_START0+i);
pEdit->GetWindowText(tempChar);
if(tempChar.IsEmpty()) buf[i]='0';
else
{
if (isdigit(tempChar[0]))
buf[i]=tempChar[0];
else
buf[i]=tempChar[0];
}
}
if(ValidateGrid(buf,m_NUM))
{
memcpy(pDoc->m_strStart ,buf,m_NUM);
pDoc->m_N=m_N;
pDoc->m_NUM=m_NUM;
}
else
{
AfxMessageBox("棋盘初始布局出错,请重新检查!");
return;
}
for(i=0;i<m_NUM;i++)
{
if (m_N==3)
pEdit=(CEdit*)GetDlgItem(IDC_EDIT_END_33_0+i);
else
pEdit=(CEdit*)GetDlgItem(IDC_EDIT_END0+i);
pEdit->GetWindowText(tempChar);
if(tempChar.IsEmpty()) buf[i]='0';
else
{
if (isdigit(tempChar[0]))
buf[i]=tempChar[0];
else
buf[i]=tempChar[0];
}
}
if(ValidateGrid(buf,m_NUM))
memcpy(pDoc->m_strEnd,buf,m_NUM);
else
{
AfxMessageBox("棋盘目标布局出错,请重新检查!");
return;
}
//char tempbuf[80];
//sprintf(tempbuf,"%s\n%s",pDoc->m_strStart,pDoc->m_strEnd);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -