⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbview.cpp

📁 管理员登录功能;读者借阅模块;读者归还模块;书籍信息模块
💻 CPP
字号:
// dbView.cpp : implementation of the CDbView class
//

#include "stdafx.h"
#include "db.h"

#include "dbDoc.h"
#include "dbView.h"
#include "AddBorrowerDlg.h"
#include "BorrowerDlg.h"
#include "LoanDlg.h"
#include "AddTitleDlg.h"
#include "BoanReturnDlg.h"
#include "AddItemDlg.h"
#include "SearchTitleDlg.h"
#include "ItemDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDbView

IMPLEMENT_DYNCREATE(CDbView, CView)

BEGIN_MESSAGE_MAP(CDbView, CView)
	//{{AFX_MSG_MAP(CDbView)
	ON_COMMAND(ID_ADDBORROWER, OnAddborrower)
	ON_COMMAND(ID_BORROWERLIST, OnBorrowerlist)
	ON_COMMAND(ID_LOANLIST, OnLoanlist)
	ON_COMMAND(ID_ADDTITLE, OnAddtitle)
	ON_COMMAND(ID_LOANRETURN, OnLoanreturn)
	ON_COMMAND(ID_ADDITEM, OnAdditem)
	ON_COMMAND(ID_SEARCHTITLE, OnSearchtitle)
	ON_COMMAND(ID_ITEMMANEGE, OnItemmanege)
	ON_WM_ERASEBKGND()
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDbView construction/destruction

CDbView::CDbView()
{
	// TODO: add construction code here

}

CDbView::~CDbView()
{
}

BOOL CDbView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CDbView drawing

void CDbView::OnDraw(CDC* pDC)
{
	CDbDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	pDC->SetTextColor(RGB(200 , 245 , 183));
	CFont font;
	VERIFY(font.CreateFont(
		20,                        // nHeight
		0,                         // nWidth
		0,                         // nEscapement
		0,                         // nOrientation
		FW_NORMAL,                 // nWeight
		FALSE,                     // bItalic
		FALSE,                     // bUnderline
		0,                         // cStrikeOut
		ANSI_CHARSET,              // nCharSet
		OUT_DEFAULT_PRECIS,        // nOutPrecision
		CLIP_DEFAULT_PRECIS,       // nClipPrecision
		DEFAULT_QUALITY,           // nQuality
		DEFAULT_PITCH | FF_SWISS,  // nPitchAndFamily
		"Arial"));                 // lpszFacename

// Do something with the font just created...
	CFont* def_font = pDC->SelectObject(&font);


// Done with the font.  Delete the font object.


	//
/*	LOGFONT logfont;
	memset(&logfont, 0, sizeof(logfont));
	logfont.lfWeight = 50;
	logfont.lfHeight = 50;
	lstrcpy(logfont.lfFaceName, "黑体");
	nowFont.CreateFontIndirect(&logfont);
	pDC->SelectObject(&nowFont);
*/
	pDC->SetBkMode(TRANSPARENT);//
	pDC->TextOut(350,300,"制作:");
	pDC->TextOut(400,300,"030501813 王贵腾");
	pDC->TextOut(400,330,"030501816  柯  超");
	pDC->TextOut(400,360,"030501825  张  航");
	font.DeleteObject();
	pDC->SelectObject(def_font);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CDbView printing

BOOL CDbView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CDbView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CDbView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CDbView diagnostics

#ifdef _DEBUG
void CDbView::AssertValid() const
{
	CView::AssertValid();
}

void CDbView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CDbDoc* CDbView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDbDoc)));
	return (CDbDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CDbView message handlers

void CDbView::OnAddborrower() 
{
	CAddBorrowerDlg dlg;
	if(dlg.DoModal() == IDCANCEL) return ;

	/*
	if(!dlg.JudgeBorrowerID(dlg.GetBorrowerID()))
	{
		AfxMessageBox("读者号已经存在!");
		return ;
	}
	if(dlg.GetBorrowerName().GetLength() == 0)
	{
		AfxMessageBox("名字不能为空!");
		return ;
	}
	dlg.InsertData(dlg.GetBorrowerID(), dlg.GetBorrowerName());
	AddList(dlg.GetBorrowerID(), dlg.GetBorrowerName());
	*/
	// TODO: Add your command handler code here
	
}

void CDbView::OnBorrowerlist() 
{
	// TODO: Add your command handler code here
	CBorrowerDlg dlg;
	dlg.DoModal();
	
}

void CDbView::OnLoanlist() 
{
	// TODO: Add your command handler code here
	CLoanDlg dlg;
	dlg.DoModal();
}

void CDbView::OnAddtitle() 
{
	// TODO: Add your command handler code here
	CAddTitleDlg dlg;
	dlg.DoModal();

	
}

void CDbView::OnLoanreturn() 
{
	CLoanReturnDlg dlg;
	dlg.DoModal();
}

void CDbView::OnAdditem() 
{
	CAddItemDlg dlg;
	dlg.DoModal();
	
}

void CDbView::OnSearchtitle() 
{
	CSearchTitleDlg dlg;
	dlg.DoModal();
}

void CDbView::OnItemmanege() 
{
	CItemDlg dlg;
	dlg.DoModal();
}

BOOL CDbView::OnEraseBkgnd(CDC* pDC) 
{
	CBitmap   bmp;   
    if   (!bmp.LoadBitmap(IDB_BITMAP1))   
		return   false;   
	BITMAP   bmpinfo;   
	bmp.GetBitmap(&bmpinfo);   
	CDC   dcmemory;   
	dcmemory.CreateCompatibleDC(pDC);   
	CBitmap*   poldbitmap   =   dcmemory.SelectObject(&bmp);   
	pDC->BitBlt(0,0,bmpinfo.bmWidth,   bmpinfo.bmHeight,   &dcmemory,0,0,SRCCOPY);   
	dcmemory.SelectObject(poldbitmap);   
	return   true;   	
	return CView::OnEraseBkgnd(pDC);
}

⌨️ 快捷键说明

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