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

📄 dlgstudent.cpp

📁 此系统为学生管理系统
💻 CPP
字号:
// DlgStudent.cpp : implementation file
//

#include "stdafx.h"
#include "stmanager.h"
#include "DlgStudent.h"
#include "student.h"//学生类头文件
#include "string.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDlgStudent dialog


CDlgStudent::CDlgStudent(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgStudent::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgStudent)
	m_cpp = 0.0;
	m_english = 0.0;
	m_major = _T("");
	m_math = 0.0;
	m_name = _T("");
	m_number = _T("");
	m_sex = _T("");
	m_addhead = 0;//把初始值改为0,默认选择添加在表头
//	m_addtail = -1;
	//}}AFX_DATA_INIT
}


void CDlgStudent::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgStudent)
	DDX_Text(pDX, IDC_EDIT_Cpp, m_cpp);
	DDV_MinMaxDouble(pDX, m_cpp, 0., 100.);
	DDX_Text(pDX, IDC_EDIT_English, m_english);
	DDV_MinMaxDouble(pDX, m_english, 0., 100.);
	DDX_Text(pDX, IDC_EDIT_Major, m_major);
	DDV_MaxChars(pDX, m_major, 16);
	DDX_Text(pDX, IDC_EDIT_Math, m_math);
	DDV_MinMaxDouble(pDX, m_math, 0., 100.);
	DDX_Text(pDX, IDC_EDIT_Name, m_name);
	DDV_MaxChars(pDX, m_name, 10);
	DDX_Text(pDX, IDC_EDIT_Number, m_number);
	DDV_MaxChars(pDX, m_number, 10);
	DDX_Text(pDX, IDC_EDIT_Sex, m_sex);
	DDV_MaxChars(pDX, m_sex, 2);
	DDX_Radio(pDX, IDC_RADIO_Head, m_addhead);
//	DDX_Radio(pDX, IDC_RADIO_Tail, m_addtail);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgStudent, CDialog)
	//{{AFX_MSG_MAP(CDlgStudent)
	ON_BN_CLICKED(IDCANCLE, OnCancle)
	ON_BN_CLICKED(IDC_RADIO_Tail, OnRADIOTail)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgStudent message handlers

void CDlgStudent::OnOK()//添加框的确定函数
{
	// TODO: Add extra validation here  
    int i=0;
	if(UpdateData()!=0)//判断是否接收
	{  

		if(m_name=="")
		{
			MessageBox("姓名不能为空");
			i++;
		}
		if(strcmp(m_sex,"")==0)	
		{
			MessageBox("性别不能为空");
			i++;
		}
		 if(strcmp(m_number,"")==0)
		 {
			 MessageBox("学号不能为空");
			 i++;
		 }
		 if(strcmp(m_major,"")==0)
		 {
			 MessageBox("专业不能为空");
			 i++;
		 }
	     if(i==0)
	     CDialog::OnOK();//撤销对话框
	    
	}
    
}

void CDlgStudent::OnCancle() 
{
    // TODO: Add your control notification handler code here
	CDialog::OnCancel();//调用此函数时输入对话框消失
}

//DEL void CDlgStudent::OnRADIOHead() 
//DEL {
//DEL 	// TODO: Add your control notification handler code here
//DEL    
//DEL }

void CDlgStudent::OnRADIOTail() 
{
	// TODO: Add your control notification handler code here
	m_addhead=1;//m_addhead的值作为输出在表头还是表尾的判断
	
}

⌨️ 快捷键说明

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