📄 stuinfodlg.cpp
字号:
// StuInfoDlg.cpp : implementation file
//
#include "stdafx.h"
#include "S2009072032.h"
#include "StuInfoDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStuInfoDlg dialog
CStuInfoDlg::CStuInfoDlg(CWnd* pParent /*=NULL*/)
: CDialog(CStuInfoDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CStuInfoDlg)
m_strName = _T("");
m_strNO = _T("");
m_tBirth = 0;
m_strSpec = _T("");
//}}AFX_DATA_INIT
this->m_strSex="男";
}
void CStuInfoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CStuInfoDlg)
DDX_Text(pDX, IDC_EDIT_NAME, m_strName);
DDV_MaxChars(pDX, m_strName, 20);
DDX_Text(pDX, IDC_EDIT_NO, m_strNO);
DDV_MaxChars(pDX, m_strNO, 20);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_tBirth);
DDX_Text(pDX, IDC_EDIT_SPEC, m_strSpec);
DDV_MaxChars(pDX, m_strSpec, 80);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CStuInfoDlg, CDialog)
//{{AFX_MSG_MAP(CStuInfoDlg)
ON_BN_CLICKED(IDC_RADIO_M, OnRadioM)
ON_BN_CLICKED(IDC_RADIO_W, OnRadioW)
ON_NOTIFY(DTN_CLOSEUP, IDC_DATETIMEPICKER1, OnCloseupDatetimepicker1)
ON_EN_CHANGE(IDC_EDIT_NAME, OnChangeEditName)
ON_EN_CHANGE(IDC_EDIT_NO, OnChangeEditNo)
ON_EN_CHANGE(IDC_EDIT_SPEC, OnChangeEditSpec)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStuInfoDlg message handlers
void CStuInfoDlg::OnRadioM()
{
// TODO: Add your control notification handler code here
m_strSex="男";
}
void CStuInfoDlg::OnRadioW()
{
// TODO: Add your control notification handler code here
m_strSex="女";
}
BOOL CStuInfoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
if(m_strSex=="女")
CheckRadioButton(IDC_RADIO_M,IDC_RADIO_W,IDC_RADIO_W);
else
CheckRadioButton(IDC_RADIO_M,IDC_RADIO_W,IDC_RADIO_M);
m_strOKText.TrimLeft();
GetDlgItem(IDOK)->SetWindowText(m_strOKText);
if(m_strOKText=="修改")
{
GetDlgItem(IDC_EDIT_NAME)->EnableWindow(FALSE);
GetDlgItem(IDC_EDIT_NO)->EnableWindow(FALSE);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CStuInfoDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();
m_strName.TrimLeft();
m_strNO.TrimLeft();
if(m_strName.IsEmpty())
MessageBox("必须有姓名!");
else if(m_strNO.IsEmpty())
MessageBox("必须有学号!");
else
CDialog::OnOK();
}
void CStuInfoDlg::OnCloseupDatetimepicker1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
*pResult = 0;
}
void CStuInfoDlg::OnChangeEditName()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void CStuInfoDlg::OnChangeEditNo()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
void CStuInfoDlg::OnChangeEditSpec()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -