【VC开源代码栏目提醒】:网学会员为广大网友收集整理了,Ex09_1View.cpp,希望对大家有所帮助!
// Ex09_1View.cpp : implementation of the CEx09_1View class
//
#include "stdafx.h"
#include "Ex09_1.h"
#include "Ex09_1Doc.h"
#include "Ex09_1View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEx09_1View
IMPLEMENT_DYNCREATE(CEx09_1View, CScrollView)
BEGIN_MESSAGE_MAP(CEx09_1View, CScrollView)
//{{AFX_MSG_MAP(CEx09_1View)
// 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, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CScrollView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CScrollView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEx09_1View construction/destruction
CEx09_1View::CEx09_1View()
{
// TODO: add construction code here
}
CEx09_1View::~CEx09_1View()
{
}
BOOL CEx09_1View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CScrollView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CEx09_1View drawing
void CEx09_1View::OnDraw(CDC* pDC)
{
CEx09_1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDC->TextOut(100,10,"这是MFC的打印功能!");//输出一行文字
pDC->Rectangle(30,100,330,400);//绘制一个矩形
}
void CEx09_1View::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
// TODO: calculate the total size of this view
sizeTotal.cx = sizeTotal.cy = 100;
SetScrollSizes(MM_TEXT, sizeTotal);
}
/////////////////////////////////////////////////////////////////////////////
// CEx09_1View printing
BOOL CEx09_1View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CEx09_1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CEx09_1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CEx09_1View diagnostics
#ifdef _DEBUG
void CEx09_1View::AssertValid() const
{
CScrollView::AssertValid();
}
void CEx09_1View::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
CEx09_1Doc* CEx09_1View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx09_1Doc)));
return (CEx09_1Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEx09_1View message handlers