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

📄 stuinputdlg.cpp

📁 学生系统输入对话框按钮及编辑框控件的使用
💻 CPP
字号:
// StuInputDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Ex MyCtrls.h"
#include "StuInputDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CStuInputDlg dialog


CStuInputDlg::CStuInputDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CStuInputDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CStuInputDlg)
	m_DataList = _T("");
	m_bDispALL = FALSE;
	m_Score1 = 0;
	m_Score2 = 0;
	m_Score3 = 0;
	m_Name = _T("");
	m_No = _T("");
	//}}AFX_DATA_INIT
}


void CStuInputDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CStuInputDlg)
	DDX_Text(pDX, IDC_DATA_LIST, m_DataList);
	DDX_Check(pDX, IDC_DISPALL, m_bDispALL);
	DDX_Text(pDX, IDC_EDIT1, m_Score1);
	DDV_MinMaxInt(pDX, m_Score1, 0, 100);
	DDX_Text(pDX, IDC_EDIT2, m_Score2);
	DDV_MinMaxInt(pDX, m_Score2, 0, 100);
	DDX_Text(pDX, IDC_EDIT3, m_Score3);
	DDV_MinMaxInt(pDX, m_Score3, 0, 100);
	DDX_Text(pDX, IDC_NAME, m_Name);
	DDX_Text(pDX, IDC_STU_NO, m_No);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CStuInputDlg, CDialog)
	//{{AFX_MSG_MAP(CStuInputDlg)
	ON_BN_CLICKED(IDC_DISPALL, OnDispall)
	ON_BN_CLICKED(IDC_INPUT, OnInput)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStuInputDlg message handlers

BOOL CStuInputDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CheckRadioButton(IDC_MAN,IDC_WOMAN,IDC_MAN);
	m_DataList.Empty();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CStuInputDlg::OnDispall() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
	CString strSex;
	int nResult=GetCheckedRadioButton(IDC_MAN,IDC_WOMAN);
	if(nResult==IDC_MAN)
		strSex="男";
	else
		strSex="女";
	if(m_bDispALL)
		m_DataList.Format("%s\t%s\t%s\t%d\t%d\t%d\t",
		m_No,m_Name,strSex,m_Score1,m_Score2,m_Score3);
	else
		m_DataList.Format("%S\t%s\t%s\n",m_No,m_Name,strSex);
	UpdateData(FALSE);
}

void CStuInputDlg::OnInput() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	OnDispall();
}

⌨️ 快捷键说明

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