📄 bysysdlg.cpp
字号:
// BySysDlg.cpp : implementation file
//
#include "stdafx.h"
#include "windows.h"
#include "BySys.h"
#include "BySysDlg.h"
#include "LoginDlg.h"
#include "YHEditDlg.h"
#include "XtSetDlg.h"
#include "AddStuDlg.h"
#include "DELDlg.h"
#include "LLZLDlg.h"
#include "SearchDlg.h"
#include "User.h"
#include "StuBySysDlg.h"
#include "ZLTJDlg1.h"
#include "OUTDlg.h"
#include "TeaBySysDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
extern CUser curUser;
extern int flag;
extern int Add_Modi;
extern int n;
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBySysDlg dialog
CBySysDlg::CBySysDlg(CWnd* pParent /*=NULL*/)
: CDialog(CBySysDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CBySysDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CBySysDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBySysDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBySysDlg, CDialog)
//{{AFX_MSG_MAP(CBySysDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_COMMAND(ID_EXIT, OnExit)
ON_COMMAND(YonghMenu, OnYonghMenu)
ON_COMMAND(SystemMenu, OnSystemMenu)
ON_COMMAND(AddMenu, OnAddMenu)
ON_COMMAND(ModiMenu, OnModiMenu)
ON_COMMAND(DelMenu, OnDelMenu)
ON_COMMAND(BySDnLlMenu, OnBySDnLlMenu)
ON_COMMAND(BysDnCxMenu, OnBysDnCxMenu)
ON_COMMAND(ReMenu, OnReMenu)
ON_COMMAND(BysZlTjMenu, OnBysZlTjMenu)
ON_COMMAND(DnZlOutMenu, OnDnZlOutMenu)
ON_COMMAND(AbMenu, OnAbMenu)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBySysDlg message handlers
BOOL CBySysDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// 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
// TODO: Add extra initialization here
CLoginDlg dlg;
CBySysDlg dlg10;
if (dlg.DoModal() != IDOK)
OnOK();
else
//读取用户信息到curUser对象中
curUser.GetData(dlg.m_UserName);
if((n ==2) && (n ==curUser.GetUser_type()-1))
{
CStuBySysDlg dlg11;
dlg11.DoModal();
CBySysDlg::OnOK();
}
if((n == 1) && (n ==curUser.GetUser_type()-1))
{
CTeaBySysDlg dlg9;
dlg9.DoModal();
CBySysDlg::OnOK();
}
if((n == 0) && (n ==curUser.GetUser_type()-1))
{
// return TRUE unless you set the focus to a control
}
if((n !=5) && (n != curUser.GetUser_type()-1))
{
MessageBox("用户类别不正确!");
CBySysDlg::OnOK();
dlg10.DoModal();
}
return TRUE;
}
void CBySysDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CBySysDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CBySysDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CBySysDlg::OnExit()
{
// TODO: Add your command handler code here
if(flag==1)
{
OnOK();
}
else if(flag==0)
{
MessageBox("你确定要退出系统了吗?按确定,退出!");
OnOK();
}
else
{
MessageBox("无法退出!");
}
}
void CBySysDlg::OnYonghMenu()
{
// TODO: Add your command handler code here
CYHEditDlg dlg;
dlg.DoModal();
}
void CBySysDlg::OnSystemMenu()
{
// TODO: Add your command handler code here
CXtSetDlg dlg1;
dlg1.m_radio=0;
dlg1.DoModal();
}
void CBySysDlg::OnAddMenu()
{
// TODO: Add your command handler code here
CAddStuDlg dlg2;
Add_Modi = 0;
dlg2.DoModal();
}
void CBySysDlg::OnModiMenu()
{
// TODO: Add your command handler code here
CAddStuDlg dlg2;
Add_Modi = 1;
dlg2.DoModal();
}
void CBySysDlg::OnDelMenu()
{
// TODO: Add your command handler code here
CDELDlg dlg3;
dlg3.DoModal();
}
void CBySysDlg::OnBySDnLlMenu()
{
// TODO: Add your command handler code here
CLLZLDlg dlg4;
dlg4.DoModal();
}
void CBySysDlg::OnBysDnCxMenu()
{
// TODO: Add your command handler code here
CSearchDlg dlg5;
dlg5.DoModal();
}
void CBySysDlg::OnReMenu()
{
// TODO: Add your command handler code here
CBySysDlg dlg6;
CDialog::OnOK();
dlg6.DoModal();
}
void CBySysDlg::OnBysZlTjMenu()
{
// TODO: Add your command handler code here
CZLTJDlg dlg7;
dlg7.DoModal();
}
void CBySysDlg::OnDnZlOutMenu()
{
// TODO: Add your command handler code here
COUTDlg dlg8;
dlg8.DoModal();
}
void CBySysDlg::OnAbMenu()
{
// TODO: Add your command handler code here
CAboutDlg dlg15;
dlg15.DoModal();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -