【VC开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VC开源代码-Ex09_2View.cpp的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
// Ex09_2View.cpp : implementation of the CEx09_2View class
//
#include "stdafx.h"
#include "Ex09_2.h"
#include "Ex09_2Doc.h"
#include "Ex09_2View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEx09_2View
IMPLEMENT_DYNCREATE(CEx09_2View, CScrollView)
BEGIN_MESSAGE_MAP(CEx09_2View, CScrollView)
//{{AFX_MSG_MAP(CEx09_2View)
// 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_2View construction/destruction
CEx09_2View::CEx09_2View()
{
// TODO: add construction code here
}
CEx09_2View::~CEx09_2View()
{
}
BOOL CEx09_2View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CScrollView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CEx09_2View drawing
void CEx09_2View::OnDraw(CDC* pDC)
{
CEx09_2Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDC->TextOut(100,10,"下面绘制矩形的映射模式为MM_LOMETRIC");//输出一行文字
pDC->SetMapMode(MM_LOMETRIC);//设置映射模式
pDC->Rectangle(30,-100,330,-400);//绘制矩形
}
void CEx09_2View::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
// TODO: calculate the total size of this view
sizeTotal.cx = sizeTotal.cy = 100;
SetScrollSizes(MM_TEXT, sizeTotal);
}
/////////////////////////////////////////////////////////////////////////////
// CEx09_2View printing
BOOL CEx09_2View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CEx09_2View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CEx09_2View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CEx09_2View diagnostics
#ifdef _DEBUG
void CEx09_2View::AssertValid() const
{
CScrollView::AssertValid();
}
void CEx09_2View::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
CEx09_2Doc* CEx09_2View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx09_2Doc)));
return (CEx09_2Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEx09_2View message handlers