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

📄 scoreregisterpage.cpp

📁 MFC与对话框编程,用dialogBar写的学生管理系统
💻 CPP
字号:
// ScoreRegisterPage.cpp : implementation file
//

#include "stdafx.h"
#include "StudentInf.h"
#include "ScoreRegisterPage.h"
#include "StudentInfWizard.h"

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

/////////////////////////////////////////////////////////////////////////////
// CScoreRegisterPage property page

IMPLEMENT_DYNCREATE(CScoreRegisterPage, CPropertyPage)

CScoreRegisterPage::CScoreRegisterPage() : CPropertyPage(CScoreRegisterPage::IDD)
{
	//{{AFX_DATA_INIT(CScoreRegisterPage)
	//}}AFX_DATA_INIT
	for(int i = 0; i < 6; i++)
		m_nPreScore[i]=0;		
	for(i = 0; i < 5; i++)
		m_SelectedCourse[i] = _T("");	
	for(i = 0; i < 5; i++)
		m_nOptScore[i]=0;
}

CScoreRegisterPage::~CScoreRegisterPage()
{
}

void CScoreRegisterPage::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CScoreRegisterPage)
	//}}AFX_DATA_MAP
	DDX_Text(pDX, IDC_PRE_SCORE_EDIT1, m_nPreScore[0]);
	DDV_MinMaxInt(pDX, m_nPreScore[0], 0,100); 
	DDX_Text(pDX, IDC_PRE_SCORE_EDIT2, m_nPreScore[1]);
	DDV_MinMaxInt(pDX, m_nPreScore[1], 0,100); 
	DDX_Text(pDX, IDC_PRE_SCORE_EDIT3, m_nPreScore[2]);
	DDV_MinMaxInt(pDX, m_nPreScore[2], 0,100); 
	DDX_Text(pDX, IDC_PRE_SCORE_EDIT4, m_nPreScore[3]);
	DDV_MinMaxInt(pDX, m_nPreScore[3], 0,100); 
	DDX_Text(pDX, IDC_PRE_SCORE_EDIT5, m_nPreScore[4]);
	DDV_MinMaxInt(pDX, m_nPreScore[4], 0,100); 
	DDX_Text(pDX, IDC_PRE_SCORE_EDIT6, m_nPreScore[5]);
	DDV_MinMaxInt(pDX, m_nPreScore[5], 0,100); 

	DDX_Text(pDX, IDC_SELECTED_COURSE1, m_SelectedCourse[0]);
	DDV_MaxChars(pDX, m_SelectedCourse[0], 20);
	DDX_Text(pDX, IDC_SELECTED_COURSE2, m_SelectedCourse[1]);
	DDV_MaxChars(pDX, m_SelectedCourse[1], 20);
	DDX_Text(pDX, IDC_SELECTED_COURSE3, m_SelectedCourse[2]);
	DDV_MaxChars(pDX, m_SelectedCourse[2], 20);
	DDX_Text(pDX, IDC_SELECTED_COURSE4, m_SelectedCourse[3]);
	DDV_MaxChars(pDX, m_SelectedCourse[3], 20);
	DDX_Text(pDX, IDC_SELECTED_COURSE5, m_SelectedCourse[4]);
	DDV_MaxChars(pDX, m_SelectedCourse[4], 20);

	DDX_Text(pDX, IDC_OPT_SCORE_EDIT1, m_nOptScore[0]);
	DDV_MinMaxInt(pDX, m_nOptScore[0], 0,100); 
	DDX_Text(pDX, IDC_OPT_SCORE_EDIT2, m_nOptScore[1]);
	DDV_MinMaxInt(pDX, m_nOptScore[1], 0,100); 
	DDX_Text(pDX, IDC_OPT_SCORE_EDIT3, m_nOptScore[2]);
	DDV_MinMaxInt(pDX, m_nOptScore[2], 0,100); 
	DDX_Text(pDX, IDC_OPT_SCORE_EDIT4, m_nOptScore[3]);
	DDV_MinMaxInt(pDX, m_nOptScore[3], 0,100); 
	DDX_Text(pDX, IDC_OPT_SCORE_EDIT5, m_nOptScore[4]);
	DDV_MinMaxInt(pDX, m_nOptScore[4], 0,100); 

}


BEGIN_MESSAGE_MAP(CScoreRegisterPage, CPropertyPage)
	//{{AFX_MSG_MAP(CScoreRegisterPage)
		// NOTE: the ClassWizard will add message map macros here
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CScoreRegisterPage message handlers

BOOL CScoreRegisterPage::OnSetActive() 
{
	// TODO: Add your specialized code here and/or call the base class
	BOOL result = CPropertyPage::OnSetActive();	
	int i,index;
	if(result== TRUE)
	{
		CStudentInfWizard *parent = (CStudentInfWizard *)GetParent();
		parent->SetWizardButtons(PSWIZB_NEXT|PSWIZB_BACK);
		for(i = 0, index = 0; i < 10; i++)
		{
		
			if(parent->m_CourseSel.m_SelectedCourse[i]!="")
			{	
				m_SelectedCourse[index]=parent->m_CourseSel.m_SelectedCourse[i];
				index++;
			}//if(前一属性页的m_SelectedCourse[i] ≠ "",即该门选修课程被选)
			//then 当前属性页的m_SelectedCourse[index] = 前一属性页的m_SelectedCourse[i]
		}
		UpdateData(FALSE);
	}
	return result;
}

CString CScoreRegisterPage::GetString()
{
	CStudentInfWizard *parent = (CStudentInfWizard *)GetParent();
	CString str;
	CString ntoStr;
	str="";
	str+="必修课程成绩:";str+="\r\n";
	for(int i=0;i<5;i++)
	{
		str+=parent->m_CourseSel.m_PrerequisiteCourse[i];str+=":";
		ntoStr.Format("%d",m_nPreScore[i]);
		str+=ntoStr;
		str+="  "; 
	}
	str+=parent->m_CourseSel.m_PrerequisiteCourse[i];str+=":";
	ntoStr.Format("%d",m_nPreScore[i]);
	str+=ntoStr;
	str+="\r\n"; 

	str+="选修课程成绩:";str+="\r\n";
	for(i=0;i<4;i++)
	{
		str+=m_SelectedCourse[i];str+=":";
		ntoStr.Format("%d",m_nOptScore[i]);
		str+=ntoStr;
		str+="  "; 
	}
	str+=m_SelectedCourse[i];str+=":";
	ntoStr.Format("%d",m_nOptScore[i]);
	str+=ntoStr;
	str+="  "; 

	return str;
}

⌨️ 快捷键说明

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