classinfodlg.cpp

来自「个人制作的一个简单的用户登陆窗口 为了实现用户密码登陆」· C++ 代码 · 共 84 行

CPP
84
字号
// ClassInfoDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ex6.h"
#include "ClassInfoDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CClassInfoDlg dialog


CClassInfoDlg::CClassInfoDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CClassInfoDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CClassInfoDlg)
	m_strClassNO = _T("");
	m_strDepart = _T("");
	m_strSpecial = _T("");
	m_tEnter = 0;
	m_strYear = _T("");
	//}}AFX_DATA_INIT
}


void CClassInfoDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CClassInfoDlg)
	DDX_Text(pDX, IDC_EDIT_CLASSNO, m_strClassNO);
	DDV_MaxChars(pDX, m_strClassNO, 10);
	DDX_Text(pDX, IDC_EDIT_DEPART, m_strDepart);
	DDV_MaxChars(pDX, m_strDepart, 60);
	DDX_Text(pDX, IDC_EDIT_SPECIAL, m_strSpecial);
	DDV_MaxChars(pDX, m_strSpecial, 60);
	DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_tEnter);
	DDX_CBString(pDX, IDC_COMBO_YEAR, m_strYear);
	DDV_MaxChars(pDX, m_strYear, 10);
	//}}AFX_DATA_MAP
}


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

/////////////////////////////////////////////////////////////////////////////
// CClassInfoDlg message handlers

BOOL CClassInfoDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	m_strYear="4";
	UpdateData(FALSE);
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CClassInfoDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData();
	m_strClassNO.TrimLeft();
	m_strDepart.TrimLeft();
	m_strSpecial.TrimLeft();
	if(m_strDepart.IsEmpty())
		MessageBox("必须要有所在院系!");
	else if(m_strSpecial.IsEmpty())
		MessageBox("必须要有专业!");
	else
	if(m_strClassNO.IsEmpty())
		MessageBox("必须要有班级号!");
	else
	CDialog::OnOK();
}

⌨️ 快捷键说明

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