📄 addstudent.cpp
字号:
// AddStudent.cpp : implementation file
//
#include "stdafx.h"
#include "StudentMIS.h"
#include "AddStudent.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAddStudent dialog
CAddStudent::CAddStudent(CWnd* pParent /*=NULL*/)
: CDialog(CAddStudent::IDD, pParent)
{
//{{AFX_DATA_INIT(CAddStudent)
m_strName = _T("");
m_strPaper = _T("");
m_strLab = _T("");
m_strAge = _T("");
m_strID = _T("");
m_nBachelor = -1;
m_nDoctor = -1;
m_nMaster = -1;
//}}AFX_DATA_INIT
}
void CAddStudent::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAddStudent)
DDX_Control(pDX, IDC_DEPARTMENT, m_department);
DDX_Text(pDX, IDC_NAME, m_strName);
DDX_Text(pDX, IDC_PAPER, m_strPaper);
DDX_Text(pDX, IDC_LAB, m_strLab);
DDX_Text(pDX, IDC_AGE, m_strAge);
DDX_Text(pDX, IDC_ID, m_strID);
DDX_Radio(pDX, IDC_RADBACHELOR, m_nBachelor);
DDX_Radio(pDX, IDC_RADDOCTOR, m_nDoctor);
DDX_Radio(pDX, IDC_RADMASTER, m_nMaster);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAddStudent, CDialog)
//{{AFX_MSG_MAP(CAddStudent)
ON_BN_CLICKED(IDC_RADMASTER, OnRadmaster)
ON_BN_CLICKED(IDC_RADDOCTOR, OnRaddoctor)
ON_BN_CLICKED(IDC_RADBACHELOR, OnRadbachelor)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAddStudent message handlers
void CAddStudent::OnOK()
{
m_department.GetLBText(m_department.GetCurSel(),m_strDepartment);
UpdateData(true);
CDialog::OnOK();
}
void CAddStudent::OnRadmaster()
{
UpdateData(true);
GetDlgItem(IDC_LAB)->EnableWindow(true);
GetDlgItem(IDC_PAPER)->EnableWindow(false);
m_nMaster = 0;
m_nDoctor = -1;
m_nBachelor = -1;
UpdateData(false);
}
void CAddStudent::OnRaddoctor()
{
UpdateData(true);
GetDlgItem(IDC_LAB)->EnableWindow(true);
GetDlgItem(IDC_PAPER)->EnableWindow(true);
m_nMaster = -1;
m_nDoctor = 0;
m_nBachelor = -1;
UpdateData(false);
}
void CAddStudent::OnRadbachelor()
{
UpdateData(true);
GetDlgItem(IDC_LAB)->EnableWindow(false);
GetDlgItem(IDC_PAPER)->EnableWindow(false);
m_nMaster = -1;
m_nDoctor = -1;
m_nBachelor = 0;
UpdateData(false);
}
BOOL CAddStudent::OnInitDialog()
{
CDialog::OnInitDialog();
if (m_bIsNew)
{
((CButton*)GetDlgItem(IDC_RADBACHELOR))->SetCheck(true);
GetDlgItem(IDC_LAB)->EnableWindow(false);
GetDlgItem(IDC_PAPER)->EnableWindow(false);
m_department.SetCurSel(0);
}
else
{
UpdateData(false);
m_department.SetCurSel(m_department.FindString(0,m_strDepartment));
if (m_strLab.CompareNoCase("")==0)
GetDlgItem(IDC_LAB)->EnableWindow(false);
if (m_strPaper.CompareNoCase("")==0)
GetDlgItem(IDC_PAPER)->EnableWindow(false);
}
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -