📄 mainfrm.cpp
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "library.h"
#include "Login.h"
#include "PunishDlg.h"
#include "NewReaderDlg.h"
#include "ReaderSearch.h"
#include "ReaderDropDlg.h"
#include "NewBookDlg.h"
#include "BorrowDlg.h"
#include "BorrowSearchDlg.h"
#include "ReturnSearchDlg.h"
#include "ReturnDlg.h"
#include "ManagerRegDlg.h"
#include "MidifyDlg.h"
#include "BookSearchDlg.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_COMMAND(ID_SYS_QUIT, OnSysQuit)
ON_COMMAND(ID_SYS_PUNISH, OnSysPunish)
ON_COMMAND(ID_READER_NEW, OnReaderNew)
ON_COMMAND(ID_READER_SEARCH, OnReaderSearch)
ON_COMMAND(ID_READER_DROP, OnReaderDrop)
ON_COMMAND(ID_NEW_BOOK, OnNewBook)
ON_COMMAND(ID_BOOK_SEARCH, OnBookSearch)
ON_COMMAND(ID_BORROW, OnBorrow)
ON_COMMAND(ID_RETURN_BOOK, OnReturnBook)
ON_COMMAND(ID_BORROW_SEARCH, OnBorrowSearch)
ON_COMMAND(ID_RETURN_SEARCH, OnReturnSearch)
ON_COMMAND(ID_SYS_USER, OnSysUser)
ON_COMMAND(ID_MODIFY, OnModify)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
/* if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
*/
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
/* m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
*/
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnSysQuit()
{
// TODO: Add your command handler code here
if(AfxMessageBox("您确定要退出系统吗?",MB_OKCANCEL)==IDCANCEL)
{
return;
}
CFrameWnd::OnClose();
}
void CMainFrame::OnSysPunish()
{
// TODO: Add your command handler code here
CPunishDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnReaderNew()
{
// TODO: Add your command handler code here
CNewReaderDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnReaderSearch()
{
// TODO: Add your command handler code here
CReaderSearch dlg;
dlg.DoModal();
}
void CMainFrame::OnReaderDrop()
{
// TODO: Add your command handler code here
CReaderDropDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnNewBook()
{
// TODO: Add your command handler code here
CNewBookDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnBookSearch()
{
// TODO: Add your command handler code here
CBookSearchDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnClose()
{
if(AfxMessageBox("您确定要退出系统吗?",MB_OKCANCEL)==IDCANCEL)
{
return;
}
CFrameWnd::OnClose();
}
void CMainFrame::OnBorrow()
{
// TODO: Add your command handler code here
CBorrowDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnReturnBook()
{
// TODO: Add your command handler code here
CReturnDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnBorrowSearch()
{
// TODO: Add your command handler code here
CBorrowSearchDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnReturnSearch()
{
// TODO: Add your command handler code here
CReturnSearchDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnSysUser()
{
// TODO: Add your command handler code here
CManagerRegDlg dlg;
dlg.DoModal();
}
void CMainFrame::OnModify()
{
// TODO: Add your command handler code here
CMidifyDlg dlg;
dlg.DoModal();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -