📄 bankview.cpp
字号:
// bankView.cpp : implementation of the CBankView class
//
#include "stdafx.h"
#include "bank.h"
#include "R3set.h"
#include "bankDoc.h"
#include "bankView.h"
#include "qddlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBankView
IMPLEMENT_DYNCREATE(CBankView, CView)
BEGIN_MESSAGE_MAP(CBankView, CView)
//{{AFX_MSG_MAP(CBankView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CBankView construction/destruction
CR3set* m_pSet;
CBankView::CBankView()
{
// TODO: add construction code here
}
CBankView::~CBankView()
{
}
BOOL CBankView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CBankView drawing
void CBankView::OnDraw(CDC* pDC)
{
CString strLine;
TEXTMETRIC metrics;
CFont TitleFont;
CFont HeadingFont;int y = 0;
CFont LineHeinght;
CFont DetailFont;
CFont FooterFont;
int nTabStops=100;
TitleFont.CreateFont(200,0,0,0,FW_BOLD,FALSE,FALSE,0,0,3,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,3,"仿宋_GB2312 ");
HeadingFont.CreateFont(100,0,0,0,FW_BOLD,FALSE,TRUE,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"仿宋_GB2312");
DetailFont.CreateFont(80,0,0,0,FW_BOLD,FALSE,FALSE,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"仿宋_GB2312");
FooterFont.CreateFont(60,0,0,0,FW_BOLD,FALSE,FALSE,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"华文彩云");
CFont* pOldFont=(CFont*)pDC->SelectObject(&TitleFont);
pDC->GetTextMetrics(&metrics);
int LineHeight=metrics.tmHeight+metrics.tmExternalLeading;
y-=LineHeight;
TEXTMETRIC tm;
pDC->GetTextMetrics(&tm);
int nLineHeight=tm.tmHeight+tm.tmExternalLeading;
CPoint pText(0,0);
CString str,da;
if (m_pSet->IsBOF()) { // detects empty recordset
return;
}
m_pSet->MoveFirst(); // fails if recordset is empty
while (!m_pSet->IsEOF()) {
str.Format("帐号:%s", m_pSet->m_cardno);
pDC->TextOut(pText.x, pText.y, str);
str.Format("操作:%s", m_pSet->m_operation);
pDC->TextOut(pText.x+1000, pText.y,str );
str.Format("操作帐号:%s", m_pSet->m_trcardno);
pDC->TextOut(pText.x+2500, pText.y, str);
str.Format("操作金额:%8.2f",m_pSet->m_operamount);
pDC->TextOut(pText.x+4500, pText.y,str );
str.Format("操作日期:%s",m_pSet->m_operdate);
pDC->TextOut(pText.x+6500, pText.y,str );
m_pSet->MoveNext();
pText.y -= nLineHeight;
}
}
void CBankView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal(10000,10000);
//::MessageBox(NULL,h,"登录错误",MB_ICONINFORMATION);
SetScrollSizes(5, sizeTotal);
// SetScrollSizes(MM_LOENGLISH, sizeTotal);
m_pSet = &GetDocument()->m_r3set;
// Remember that documents/views are reused in SDI applications!
//m_pSet->m_strFilter="[Student].[StudentID]=[Enrollment].[StudentID]";
if (m_pSet->IsOpen()) {
m_pSet->Close();
}
Cqddlg dlg;//CString m_oper=;
m_pSet->Open(CRecordset::dynaset,_T("select * from trans where cardno='"+dlg.m_card+"' "));
}
/////////////////////////////////////////////////////////////////////////////
// CBankView printing
BOOL CBankView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CBankView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CBankView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CBankView diagnostics
#ifdef _DEBUG
void CBankView::AssertValid() const
{
CView::AssertValid();
}
void CBankView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CBankDoc* CBankView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CBankDoc)));
return (CBankDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CBankView message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -