📄 personinfpage.cpp
字号:
// PersonInfPage.cpp : implementation file
//
#include "stdafx.h"
#include "StudentInf.h"
#include "PersonInfPage.h"
//#include "StudentInfView.h" 不可嵌套包含
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPersonInfPage property page
IMPLEMENT_DYNCREATE(CPersonInfPage, CPropertyPage)
CPersonInfPage::CPersonInfPage() : CPropertyPage(CPersonInfPage::IDD)
{
//{{AFX_DATA_INIT(CPersonInfPage)
m_szID = _T("");
m_szName = _T("");
m_szSex = _T("");
m_nAge = 0;
m_szDept = _T("");
m_szPhoneNo = _T("");
m_szAddress = _T("");
//}}AFX_DATA_INIT
}
CPersonInfPage::~CPersonInfPage()
{
}
void CPersonInfPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPersonInfPage)
DDX_Control(pDX, IDC_AGE_SPIN, m_ctrlAgeSpin);
DDX_Text(pDX, IDC_ID_EDIT, m_szID);
DDX_Text(pDX, IDC_NAME_EDIT, m_szName);
DDX_CBString(pDX, IDC_SEX_COMBO, m_szSex);
DDX_Text(pDX, IDC_AGE_EDIT, m_nAge);
DDX_CBString(pDX, IDC_DEPT_COMBO, m_szDept);
DDX_Text(pDX, IDC_PHONE_NUM_EDIT, m_szPhoneNo);
DDX_Text(pDX, IDC_ADDRESS_EDIT, m_szAddress);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPersonInfPage, CPropertyPage)
//{{AFX_MSG_MAP(CPersonInfPage)
ON_EN_KILLFOCUS(IDC_ID_EDIT, OnKillfocusIdEdit)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPersonInfPage message handlers
BOOL CPersonInfPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// TODO: Add extra initialization here
m_ctrlAgeSpin.SetBuddy(GetDlgItem(IDC_AGE_EDIT));
m_ctrlAgeSpin.SetRange(18,30);
m_ctrlAgeSpin.SetPos(20);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CPersonInfPage::OnSetActive()
{
// TODO: Add your specialized code here and/or call the base class
BOOL result = CPropertyPage::OnSetActive();
if(result)
{
CPropertySheet *parent = (CPropertySheet*)GetParent();
parent->SetWizardButtons(PSWIZB_NEXT);
}
return result;
}
LRESULT CPersonInfPage::OnWizardNext()
{
// TODO: Add your specialized code here and/or call the base class
UpdateData();
if(m_szAddress==""||m_szDept==""||m_szID==""||m_szName==""||m_szPhoneNo==""||
m_szSex=="")
{
MessageBox("信息不得为空!","请输入完整信息");
return -1;
}
return CPropertyPage::OnWizardNext();
}
void CPersonInfPage::OnKillfocusIdEdit()
{
// TODO: Add your control notification handler code here
CString str;
UpdateData();
CFrameWnd *MnFrm=(CFrameWnd *)AfxGetMainWnd();
MnFrm->GetActiveView()->GetWindowText(str);
if(str.Find((LPCTSTR)m_szID)!=-1)
{
MessageBox("此学号已经存在","请重新输入");
m_szID = "";
}
CEdit *text=(CEdit *)GetDlgItem(IDC_ID_EDIT);//调用UpdateData清除控件IDC_ID_EDIT中的输入信息
text->UpdateData(FALSE);
}
CString CPersonInfPage::GetString()
{
CString str;
str="";
str+="学号:";str+=m_szID;str+="\r\n";
str+="姓名:";str+=m_szName;str+="\r\n";
str+="性别:";str+=m_szSex;str+="\r\n";
str+="年龄:";
CString str1;
str1.Format("%d",m_nAge);
str+=str1;str+="\r\n";
str+="系别:";str+=m_szDept;str+="\r\n";
str+="电话:";str+=m_szPhoneNo;str+="\r\n";
str+="地址:";str+=m_szAddress;str+="\r\n";
return str;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -