📄 mytestdlg.cpp
字号:
// MyTestDlg.cpp : implementation file
//
#include "stdafx.h"
#include "test.h"
#include "MyTestDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyTestDlg dialog
CMyTestDlg::CMyTestDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMyTestDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMyTestDlg)
m_nModeNum = 1;
//}}AFX_DATA_INIT
POSITION pos = ::AfxGetApp()->GetFirstDocTemplatePosition();
CDocTemplate * pTemp = (CDocTemplate*)::AfxGetApp()->GetNextDocTemplate(pos);
pos = pTemp->GetFirstDocPosition();
pDoc = (CTestDoc*)pTemp->GetNextDoc(pos);
if (!pDoc)::AfxMessageBox("No Document");
}
void CMyTestDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyTestDlg)
DDX_Text(pDX, IDC_EDIT_TEST, m_nModeNum);
DDV_MinMaxInt(pDX, m_nModeNum, 1, 100);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyTestDlg, CDialog)
//{{AFX_MSG_MAP(CMyTestDlg)
ON_BN_CLICKED(ID_KEY_OK_TEST, OnKeyOkTest)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyTestDlg message handlers
BOOL CMyTestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CString str;
TRACE("\nTOTAL=%d\n",pDoc->number_of_input_patterns);
str.Format("请输入模式号(1-%d):",pDoc->number_of_input_patterns);
SetDlgItemText(IDC_STATIC_T,str);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CMyTestDlg::OnOK()
{
// TODO: Add extra validation here
}
void CMyTestDlg::OnKeyOkTest()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if (m_nModeNum<=pDoc->number_of_input_patterns)
{
CDialog::OnOK();
}
else
{
::AfxMessageBox("输入值超出域");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -