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

📄 coursedlg.cpp

📁 my-project-VC++学生信息系统
💻 CPP
字号:
// CourseDlg.cpp : implementation file
//

#include "stdafx.h"
#include "S2009072032.h"
#include "CourseDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCourseDlg dialog


CCourseDlg::CCourseDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCourseDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCourseDlg)
	m_coursetype = _T("");
	m_coursename = _T("");
	m_courseNO = _T("");
	m_major = _T("");
	m_credit = 0.0f;
	m_studyhours = 0;
	m_term = _T("");
	//}}AFX_DATA_INIT
}


void CCourseDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCourseDlg)
	DDX_Control(pDX, IDC_COMBO_TERM, m_comboterm);
	DDX_Control(pDX, IDC_COMBO_COURSETYPE, m_combotype);
	DDX_CBString(pDX, IDC_COMBO_COURSETYPE, m_coursetype);
	DDV_MaxChars(pDX, m_coursetype, 40);
	DDX_Text(pDX, IDC_EDIT_COURSENAME, m_coursename);
	DDV_MaxChars(pDX, m_coursename, 80);
	DDX_Text(pDX, IDC_EDIT_COURSENO, m_courseNO);
	DDV_MaxChars(pDX, m_courseNO, 7);
	DDX_Text(pDX, IDC_EDIT_MAJOR, m_major);
	DDV_MaxChars(pDX, m_major, 80);
	DDX_Text(pDX, IDC_EDIT_CREDIT, m_credit);
	DDV_MinMaxFloat(pDX, m_credit, 0.f, 10.f);
	DDX_Text(pDX, IDC_EDIT_STUDYHOURS, m_studyhours);
	DDV_MinMaxByte(pDX, m_studyhours, 0, 100);
	DDX_CBString(pDX, IDC_COMBO_TERM, m_term);
	DDV_MaxChars(pDX, m_term, 10);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCourseDlg, CDialog)
	//{{AFX_MSG_MAP(CCourseDlg)
	ON_EN_CHANGE(IDC_EDIT_COURSENAME, OnChangeEditCoursename)
	ON_EN_CHANGE(IDC_EDIT_COURSENO, OnChangeEditCourseno)
	ON_EN_CHANGE(IDC_EDIT_CREDIT, OnChangeEditCredit)
	ON_EN_CHANGE(IDC_EDIT_MAJOR, OnChangeEditMajor)
	ON_EN_CHANGE(IDC_EDIT_STUDYHOURS, OnChangeEditStudyhours)
	ON_CBN_SELCHANGE(IDC_COMBO_COURSETYPE, OnSelchangeComboCoursetype)
	ON_CBN_SELCHANGE(IDC_COMBO_TERM, OnSelchangeComboTerm)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCourseDlg message handlers

BOOL CCourseDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_strOKText.TrimLeft();
	GetDlgItem(IDOK)->SetWindowText(m_strOKText);
	if(this->m_strOKText=="修改")
	{												
		GetDlgItem(IDC_EDIT_COURSENO)->EnableWindow(FALSE);			
		GetDlgItem(IDC_EDIT_COURSENAME)->EnableWindow(FALSE);	
	}		
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CCourseDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData();
	m_coursename.TrimLeft();
	m_courseNO.TrimLeft();
	if(m_courseNO.IsEmpty())
		MessageBox("课程代号不能为空!");
	else
		if(m_coursename.IsEmpty())
			MessageBox("课程名称不能为空!");
		else
			CDialog::OnOK();
}

void CCourseDlg::OnChangeEditCoursename() 
{
	// 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 CCourseDlg::OnChangeEditCourseno() 
{
	// 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 CCourseDlg::OnChangeEditCredit() 
{
	// 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 CCourseDlg::OnChangeEditMajor() 
{
	// 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 CCourseDlg::OnChangeEditStudyhours() 
{
	// 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 CCourseDlg::OnSelchangeComboCoursetype() 
{
	// TODO: Add your control notification handler code here
	int nIndex=this->m_combotype.GetCurSel();							
	if(nIndex!=CB_ERR)	
		this->m_combotype.GetLBText(nIndex, this->m_coursetype);  
}

void CCourseDlg::OnSelchangeComboTerm() 
{
	// TODO: Add your control notification handler code here
	int nIndex=this->m_comboterm.GetCurSel();							
	if(nIndex!=CB_ERR)	
		this->m_comboterm.GetLBText(nIndex, this->m_term);  
}

⌨️ 快捷键说明

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