⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adddlg.cpp

📁 MFC做的学生管理系统
💻 CPP
字号:
// AddDlg.cpp : implementation file
//

#include "stdafx.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAddDlg dialog


CAddDlg::CAddDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CAddDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CAddDlg)
	m_nEditAge = 0;
	m_strEditName = _T("");
	m_strEditSex = _T("");
	m_strEditTel = _T("");
	m_strEditStuNum = _T("");
	m_strEditEducation = _T("");
	m_nEditComputer = 0;
	m_nEditEnglish = 0;
	m_nEditEthic = 0;
	//}}AFX_DATA_INIT
}


void CAddDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAddDlg)
	DDX_Text(pDX, IDC_EditAge, m_nEditAge);
	DDX_Text(pDX, IDC_EditName, m_strEditName);
	DDX_Text(pDX, IDC_EditSex, m_strEditSex);
	DDX_Text(pDX, IDC_EditTel, m_strEditTel);
	DDX_Text(pDX, IDC_EditStuNum, m_strEditStuNum);
	DDX_Text(pDX, IDC_EditEducation, m_strEditEducation);
	DDX_Text(pDX, IDC_EditComputer, m_nEditComputer);
	DDX_Text(pDX, IDC_EditEnglish, m_nEditEnglish);
	DDX_Text(pDX, IDC_EditEthic, m_nEditEthic);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAddDlg, CDialog)
	//{{AFX_MSG_MAP(CAddDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAddDlg message handlers

void CAddDlg::OnOK() 
{
	// TODO: Add extra validation here	
	CDialog::OnOK();

   CStudent* pCStudent = new CStudent;

   pCStudent->m_strName = this->m_strEditName;
   pCStudent->m_strSex = this->m_strEditSex;
   pCStudent->m_nAge = this->m_nEditAge;
   pCStudent->m_strTel = this->m_strEditTel;
   pCStudent->m_strStuNum = this->m_strEditStuNum;
   pCStudent->m_strEducation = this->m_strEditEducation;
   pCStudent->m_csScore.m_nComputer = this->m_nEditComputer;
   pCStudent->m_csScore.m_nEnglish = this->m_nEditEnglish;
   pCStudent->m_csScore.m_nEthic = this->m_nEditEthic;

   CMfcDesignDoc* pDoc = theApp.GetDocPointer();

   pDoc->m_StudentList.AddTail(pCStudent);
   
   MessageBox("增加成功");
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -