www.pudn.com > 单文档多视图.rar > View4.cpp
// View4.cpp : implementation file
//
#include "stdafx.h"
#include "SdiMulti.h"
#include "View4.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// C4View
IMPLEMENT_DYNCREATE(C4View, CView)
C4View::C4View()
{
}
C4View::~C4View()
{
}
BEGIN_MESSAGE_MAP(C4View, CView)
//{{AFX_MSG_MAP(C4View)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// C4View drawing
void C4View::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
CRect rect; GetClientRect(&rect);
rect.InflateRect(-10, -10);
pDC->MoveTo(rect.left, rect.top);
pDC->LineTo(rect.right, rect.top);
pDC->LineTo(rect.right, rect.bottom);
pDC->LineTo(rect.left, rect.bottom);
pDC->LineTo(rect.left, rect.top);
CString strText("This is the CView");
CSize sizeText = pDC->GetTextExtent(strText);
CPoint pointText = rect.CenterPoint();
pointText.Offset(-sizeText.cx / 2, -sizeText.cy / 2);
pDC->TextOut(pointText.x, pointText.y, strText);
}
/////////////////////////////////////////////////////////////////////////////
// C4View diagnostics
#ifdef _DEBUG
void C4View::AssertValid() const
{
CView::AssertValid();
}
void C4View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// C4View message handlers