mdibillview.cpp
来自「本光盘包含的是《实用Visual C++ 6.0教程》一书中所有程序的代码」· C++ 代码 · 共 90 行
CPP
90 行
// MDIBillView.cpp : implementation file
//
#include "stdafx.h"
#include "MDICoin.h"
#include "MDIBillView.h"
#include "MDIBillDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMDIBillView
IMPLEMENT_DYNCREATE(CMDIBillView, CView)
CMDIBillView::CMDIBillView()
{
}
CMDIBillView::~CMDIBillView()
{
}
BEGIN_MESSAGE_MAP(CMDIBillView, CView)
//{{AFX_MSG_MAP(CMDIBillView)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMDIBillView drawing
void CMDIBillView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
CBrush* pOldBrush = pDC->GetCurrentBrush( );
// ** Create a solid green brush
CBrush br;
br.CreateSolidBrush(RGB(0,128,32));
// ** Select the green brush into the device context
pDC->SelectObject(&br);
// ** Retrieve the number of bills from the document
// and draw a rectangle and a $ to represent the bill
for (int nCount = 0; nCount < ((CMDIBillDoc*)pDoc)->GetBillCount( );
nCount++)
{
int x = 40 + 20 * nCount;
pDC->Rectangle(x,40,x+100,90);
pDC->TextOut(x+5,45,"$");
}
// ** Restore the current brush
pDC->SelectObject(pOldBrush);
}
/////////////////////////////////////////////////////////////////////////////
// CMDIBillView diagnostics
#ifdef _DEBUG
void CMDIBillView::AssertValid() const
{
CView::AssertValid();
}
void CMDIBillView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMDIBillView message handlers
CMDIBillDoc* CMDIBillView::GetDocument()
{
return (CMDIBillDoc*)m_pDocument;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?