www.gusucode.com > 《C++高级语言程序设计》PPT及全书例子源代码-源码程序 > 《C++高级语言程序设计》PPT及全书例子源代码-源码程序/code/C++例题程序/第10章/s10_1/s10_1View.cpp

    //Download by http://www.NewXing.com
// s10_1View.cpp : implementation of the CS10_1View class
//

#include "stdafx.h"
#include "s10_1.h"

#include "s10_1Doc.h"
#include "s10_1View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CS10_1View

IMPLEMENT_DYNCREATE(CS10_1View, CView)

BEGIN_MESSAGE_MAP(CS10_1View, CView)
	//{{AFX_MSG_MAP(CS10_1View)
	ON_WM_PAINT()
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CS10_1View construction/destruction

CS10_1View::CS10_1View()
{
	// TODO: add construction code here

}

CS10_1View::~CS10_1View()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CS10_1View drawing

void CS10_1View::OnDraw(CDC* pDC)
{
	CS10_1Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CS10_1View printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CS10_1View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CS10_1View message handlers

void CS10_1View::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	CRect oRectangle;				// 定义矩形区域对象
	GetClientRect(&oRectangle);		// 由oRectangle返回客户区
	dc.Ellipse(oRectangle);			// 在客户区画一个椭圆
	
	// Do not call CView::OnPaint() for painting messages
}