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

📄 银行系统view.cpp

📁 这是一个用VC++编写的银行定期储蓄管理系统
💻 CPP
字号:
// 银行系统View.cpp : implementation of the CMyView class
//


#include "stdafx.h"
#include "银行系统.h"

#include "银行系统Doc.h"
#include "银行系统View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyView

IMPLEMENT_DYNCREATE(CMyView, CView)

BEGIN_MESSAGE_MAP(CMyView, CView)
	//{{AFX_MSG_MAP(CMyView)
	ON_COMMAND(ID_MENUITEM32771, OnSave)
	ON_COMMAND(ID_MENUITEM32772, OnLoad)
	ON_COMMAND(ID_MENUITEM32773, OnMiss)
	ON_COMMAND(ID_MENUITEM32775, OnConsult)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CMyView construction/destruction

CMyView::CMyView()
{
	// TODO: add construction code here
    issave = FALSE;
	isload = FALSE;
	ismiss = FALSE;
	MyView = this;
}

CMyView::~CMyView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMyView drawing

void CMyView::OnDraw(CDC* pDC)
{
	CMyDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
    pDC->SetBkColor(RGB(240,240,250));
	pDC->SetTextColor(RGB(0,150,250));
	int ny = 30;
	if(issave) {pDC->TextOut(2,5,"存款信息:");FontOutSave(pDC,ny,21);issave = FALSE;return;}
    if(isload) {pDC->TextOut(2,5,"取款信息:");FontOutLoad(pDC,ny,21);isload = FALSE;return;}
	if(ismiss) {pDC->TextOut(1,1,missinfo);ismiss = FALSE;return;}
}

/////////////////////////////////////////////////////////////////////////////
// CMyView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMyView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMyView message handlers

void CMyView::OnSave() 
{
	// TODO: Add your command handler code here
	SaveDialog savedialog;
	savedialog.DoModal();
}

void CMyView::OnLoad() 
{
	// TODO: Add your command handler code here
	LoadDialog loaddialog;
	loaddialog.DoModal();
}

void CMyView::OnMiss() 
{
	// TODO: Add your command handler code here
	MissDialog missdialog;
	missdialog.DoModal();
}

void CMyView::OnConsult() 
{
	// TODO: Add your command handler code here
    ConsultDialog consultdialog;
	consultdialog.DoModal();
}

void CMyView::FontOutSave(CDC *pDC,int &nHeight,int nPoints)
{
     TEXTMETRIC textM;
	 CFont font;
	 font.CreateFont(nPoints,0,0,0,400,FALSE,FALSE,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
		             CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS,"宋体");
	 CFont *poldfont = (CFont*)pDC->SelectObject(&font);
	 pDC->GetTextMetrics(&textM);
	 for(int i = 0;i<6;i++)
	 {
		 saveinfo[i].Format(saveinfo[i],nPoints);
		 pDC->TextOut(10,nHeight,saveinfo[i]);
		 nHeight += (textM.tmHeight + textM.tmExternalLeading);
	 }
	 pDC->SelectObject(poldfont);
}

void CMyView::FontOutLoad(CDC *pDC,int &nHeight,int nPoints)
{
     TEXTMETRIC textM;
	 CFont font;
	 font.CreateFont(nPoints,0,0,0,400,FALSE,FALSE,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
		             CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_SWISS,"宋体");
	 CFont *poldfont = (CFont*)pDC->SelectObject(&font);
	 pDC->GetTextMetrics(&textM);
	 for(int i = 0;i<7;i++)
	 {
		 loadinfo[i].Format(loadinfo[i],nPoints);
		 pDC->TextOut(10,nHeight,loadinfo[i]);
		 nHeight += (textM.tmHeight + textM.tmExternalLeading);
	 }
	 pDC->SelectObject(poldfont);
}

⌨️ 快捷键说明

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