📄 inputdlg.cpp
字号:
// InputDlg.cpp : implementation file
//
#include "stdafx.h"
#include "student.h"
#include "InputDlg.h"
#include "StudentDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInputDlg dialog
CInputDlg::CInputDlg(CWnd* pParent /*=NULL*/)
: CDialog(CInputDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CInputDlg)
m_num = _T("");
m_name = _T("");
m_tc = FALSE;
m_ss = FALSE;
m_bs = FALSE;
m_sex = -1;
m_listitute = _T("");
//}}AFX_DATA_INIT
}
void CInputDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CInputDlg)
DDX_Control(pDX, IDC_LIST1, m_slistitute);
DDX_Text(pDX, IDC_EDIT1, m_num);
DDX_Text(pDX, IDC_EDIT2, m_name);
DDX_Check(pDX, IDC_CHECK1, m_tc);
DDX_Check(pDX, IDC_CHECK2, m_ss);
DDX_Check(pDX, IDC_CHECK3, m_bs);
DDX_Radio(pDX, IDC_boy, m_sex);
DDX_LBString(pDX, IDC_LIST1, m_listitute);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CInputDlg, CDialog)
//{{AFX_MSG_MAP(CInputDlg)
ON_BN_CLICKED(IDC_end, Onend)
ON_BN_CLICKED(IDC_save, Onsave)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInputDlg message handlers
void CInputDlg::Onend()
{
// TODO: Add your control notification handler code here
OnOK();
}
BOOL CInputDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_slistitute.AddString("机电学院");
m_slistitute.AddString("资信学院");
m_slistitute.AddString("土木学院");
m_slistitute.AddString("化工学院");
m_slistitute.AddString("石油学院");
m_slistitute.AddString("物理学院");
m_slistitute.AddString("数学学院");
m_slistitute.AddString("人文学院");
m_sex=0;
m_slistitute.SetCurSel(0);
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CInputDlg::Onsave()
{
// TODO: Add your control notification handler code here
int m=CStudentDlg::s_count;
bool exist =false;
UpdateData();
for(int i=0;i<m;i++)
if(CStudentDlg::s_student[i].s_number==m_num)
{ exist=true;
MessageBox("已存在");
break;
}
if(exist==false)
{ if(m<100)
{ CStudentDlg::s_student[i].s_number=m_num;
CStudentDlg::s_student[i].s_name=m_name;
CStudentDlg::s_student[i].s_institute=m_listitute;
CStudentDlg::s_student[i].s_sex=m_sex;
CStudentDlg::s_student[i].s_strong=m_tc;
CStudentDlg::s_student[i].s_minority=m_ss;
CStudentDlg::s_student[i].s_mainland=m_bs;
CStudentDlg::s_count++;
m_num=m_name=m_listitute="";
m_sex=0;
m_tc=m_ss=m_bs=0;
m_slistitute.SetCurSel(0);
UpdateData(false);
}
else
{ MessageBox("信息已满");}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -