📄 fileexamdlg.cpp
字号:
// FileExamDlg.cpp : implementation file
//
#include "stdafx.h"
#include "FileExam.h"
#include "FileExamDlg.h"
// #include "Afxtempl.h"
#include "sipapi.h"
#include "Main1.h"
#include "hint.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CList<CStudentData,CStudentData&> m_lststudent;
//定义操作标识,0代表添加,1代表编辑
extern int m_operID;
CStudentData studentdata;
extern int listnum;
extern int findpos[10000];//存放找到的记录的位置
extern int hinttext;
CString NO;
/////////////////////////////////////////////////////////////////////////////
// CFileExamDlg dialog
CFileExamDlg::CFileExamDlg(CWnd* pParent /*=NULL*/)
: CDialog(CFileExamDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CFileExamDlg)
m_xsbh = _T("");
m_xsxm = _T("");
m_csrq = _T("");
m_bjmc = _T("");
m_xsxb = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CFileExamDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFileExamDlg)
DDX_Control(pDX, IDOK, m_btnsave);
DDX_Control(pDX, IDCANCEL, m_btncancel);
DDX_Control(pDX, IDC_Sxsbh, s_xsbh);
DDX_Control(pDX, IDC_Sxsxm, s_xsxm);
DDX_Control(pDX, IDC_Sxsxb, s_xsxb);
DDX_Control(pDX, IDC_Scsrq, s_csrq);
DDX_Control(pDX, IDC_Sbjmc, s_bjmc);
DDX_Control(pDX, IDC_DELETE, m_delete);
DDX_Control(pDX, IDC_EDTCSRQ, csrq);
DDX_Control(pDX, IDC_EDTBJMC, bjmc);
DDX_Control(pDX, IDC_CMBXSXB, xsxb);
DDX_Control(pDX, IDC_EDTXSXM, xsxm);
DDX_Control(pDX, IDC_EDTXSBH, xsbh);
DDX_Text(pDX, IDC_EDTXSBH, m_xsbh);
DDX_Text(pDX, IDC_EDTXSXM, m_xsxm);
DDX_Text(pDX, IDC_EDTCSRQ, m_csrq);
DDX_Text(pDX, IDC_EDTBJMC, m_bjmc);
DDX_CBString(pDX, IDC_CMBXSXB, m_xsxb);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFileExamDlg, CDialog)
//{{AFX_MSG_MAP(CFileExamDlg)
// ON_BN_CLICKED(IDC_BTNFIRST, OnBtnfirst)
// ON_BN_CLICKED(IDC_BTNPRIOR, OnBtnprior)
// ON_BN_CLICKED(IDC_BTNNEXT, OnBtnnext)
// ON_BN_CLICKED(IDC_BTNLAST, OnBtnlast)
// ON_BN_CLICKED(IDC_BTNADD, OnBtnadd)
// ON_BN_CLICKED(IDC_BTNEDIT, OnBtnedit)
// ON_BN_CLICKED(IDC_BTNSAVE, OnBtnsave)
// ON_BN_CLICKED(IDC_BTNCANCEL, OnBtncancel)
// ON_BN_CLICKED(IDC_DELETE, OnDelete)
ON_EN_SETFOCUS(IDC_EDTXSBH, OnSetfocusEdtxsbh)
ON_EN_KILLFOCUS(IDC_EDTXSBH, OnKillfocusEdtxsbh)
ON_EN_KILLFOCUS(IDC_EDTXSXM, OnKillfocusEdtxsxm)
ON_EN_SETFOCUS(IDC_EDTXSXM, OnSetfocusEdtxsxm)
ON_EN_SETFOCUS(IDC_EDTCSRQ, OnSetfocusEdtcsrq)
ON_EN_KILLFOCUS(IDC_EDTCSRQ, OnKillfocusEdtcsrq)
ON_EN_SETFOCUS(IDC_EDTBJMC, OnSetfocusEdtbjmc)
ON_EN_KILLFOCUS(IDC_EDTBJMC, OnKillfocusEdtbjmc)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFileExamDlg message handlers
BOOL CFileExamDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
controlDlg();//控制窗口和控件
//CenterWindow(GetDesktopWindow()); // center to the hpc screen
// TODO: Add extra initialization here
CFile stufile;
// CStudentData studentdata;
POSITION pos;
switch(m_operID)
{
case 0://新建
m_xsbh = _T("");
m_xsxm = _T("");
m_csrq = _T("");
m_bjmc = _T("");
m_xsxb = _T("");
UpdateData(false);
break;
case 1://查找前
pos=m_lststudent.FindIndex(listnum);
studentdata=m_lststudent.GetAt(pos);
m_xsbh=studentdata.xsbh;
m_xsxm=studentdata.xsxm;
m_xsxb=studentdata.xb;
m_csrq=studentdata.csrq;
m_bjmc=studentdata.bjmc;
UpdateData(false);
break;
case 2://查找后
pos=m_lststudent.FindIndex(findpos[listnum]);
studentdata=m_lststudent.GetAt(pos);
m_xsbh=studentdata.xsbh;
m_xsxm=studentdata.xsxm;
m_xsxb=studentdata.xb;
m_csrq=studentdata.csrq;
m_bjmc=studentdata.bjmc;
UpdateData(false);
break;
}
return true;
}
// //初始化界面显示
// if(m_lststudent.GetCount()>0)
// {
// studentdata=m_lststudent.GetHead();
// m_iCurPos=0;
// //初始化第一条显示
// m_xsbh=studentdata.xsbh;
// m_xsxm=studentdata.xsxm;
// m_xsxb=studentdata.xb;
// m_csrq=studentdata.csrq;
// m_bjmc=studentdata.bjmc;
// UpdateData(false);
//
// }
// SetControlEnable(false);
// SetNavigatorButton(m_iCurPos);
// return TRUE; // return TRUE unless you set the focus to a control
//}
//设置控件的有效性
/*
void CFileExamDlg::SetControlEnable(bool aValue)
{
//设置输入框的有效性
xsbh.EnableWindow(aValue);
xsxm.EnableWindow(aValue);
xsxb.EnableWindow(aValue);
csrq.EnableWindow(aValue);
bjmc.EnableWindow(aValue);
//设置指针按钮的有效性
m_btnfirst.EnableWindow(!aValue);
m_btnprior.EnableWindow(!aValue);
m_btnnext.EnableWindow(!aValue);
m_btnlast.EnableWindow(!aValue);
//设置操作按钮的有效性
m_btnadd.EnableWindow(!aValue);
m_btnedit.EnableWindow(!aValue);
m_btncancel.EnableWindow(aValue);
m_btnsave.EnableWindow(aValue);
m_delete.EnableWindow(!aValue);
}*/
//设置指针移动按钮的有效性
/*
void CFileExamDlg::SetNavigatorButton(int aValue)
{
//如果学生队列数据小于2
if(m_lststudent.GetCount()<2)
{
m_btnfirst.EnableWindow(false);
m_btnprior.EnableWindow(false);
m_btnnext.EnableWindow(false);
m_btnlast.EnableWindow(false);
return;
}
//指针移动到首部
if(aValue==0)
{
m_btnfirst.EnableWindow(false);
m_btnprior.EnableWindow(false);
if(m_lststudent.GetCount()>=2)
{
m_btnnext.EnableWindow(true);
m_btnlast.EnableWindow(true);
}
}//如果指针移动到末尾
else if(aValue==m_lststudent.GetCount()-1)
{
m_btnnext.EnableWindow(false);
m_btnlast.EnableWindow(false);
if(m_lststudent.GetCount()>=2)
{
m_btnfirst.EnableWindow(true);
m_btnprior.EnableWindow(true);
}
}
else
{
m_btnfirst.EnableWindow(true);
m_btnprior.EnableWindow(true);
m_btnnext.EnableWindow(true);
m_btnlast.EnableWindow(true);
}
}*/
/*
void CFileExamDlg::OnBtnfirst()
{
// TODO: Add your control notification handler code here
CStudentData studentdata=m_lststudent.GetHead();
m_iCurPos=0;
//更新显示
m_xsbh=studentdata.xsbh;
m_xsxm=studentdata.xsxm;
m_xsxb=studentdata.xb;
m_csrq=studentdata.csrq;
m_bjmc=studentdata.bjmc;
UpdateData(false);
//设置指针移动按钮的有效性
SetNavigatorButton(m_iCurPos);
}*/
/*
void CFileExamDlg::OnBtnprior()
{
// TODO: Add your control notification handler code here
m_iCurPos--;
POSITION pos=m_lststudent.FindIndex(m_iCurPos);
CStudentData studentdata=m_lststudent.GetAt(pos);
//更新显示
m_xsbh=studentdata.xsbh;
m_xsxm=studentdata.xsxm;
m_xsxb=studentdata.xb;
m_csrq=studentdata.csrq;
m_bjmc=studentdata.bjmc;
UpdateData(false);
//设置指针移动按钮的有效性
SetNavigatorButton(m_iCurPos);
}*/
/*
void CFileExamDlg::OnBtnnext()
{
// TODO: Add your control notification handler code here
m_iCurPos++;
POSITION pos=m_lststudent.FindIndex(m_iCurPos);
CStudentData studentdata=m_lststudent.GetAt(pos);
//更新显示
m_xsbh=studentdata.xsbh;
m_xsxm=studentdata.xsxm;
m_xsxb=studentdata.xb;
m_csrq=studentdata.csrq;
m_bjmc=studentdata.bjmc;
UpdateData(false);
//设置指针移动按钮的有效性
SetNavigatorButton(m_iCurPos);
}*/
/*
void CFileExamDlg::OnBtnlast()
{
// TODO: Add your control notification handler code here
CStudentData studentdata=m_lststudent.GetTail();
m_iCurPos=m_lststudent.GetCount()-1;
//更新显示
m_xsbh=studentdata.xsbh;
m_xsxm=studentdata.xsxm;
m_xsxb=studentdata.xb;
m_csrq=studentdata.csrq;
m_bjmc=studentdata.bjmc;
UpdateData(false);
//设置指针移动按钮的有效性
SetNavigatorButton(m_iCurPos);
}*/
/*
void CFileExamDlg::OnBtnadd()
{
// TODO: Add your control notification handler code here
m_operID=0;//表示添加操作
m_xsbh=L"";
m_xsxm=L"";
m_xsxb=L"";
m_csrq=L"";
m_bjmc=L"";
UpdateData(false);
SetControlEnable(true);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -