【VC开源代码栏目提醒】:网学会员为广大网友收集整理了,DrawTextView.cpp,希望对大家有所帮助!
// DrawTextView.cpp : implementation of the CDrawTextView class
//
#include "stdafx.h"
#include "DrawText.h"
#include "DrawTextDoc.h"
#include "DrawTextView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDrawTextView
IMPLEMENT_DYNCREATE(CDrawTextView, CView)
BEGIN_MESSAGE_MAP(CDrawTextView, CView)
//{{AFX_MSG_MAP(CDrawTextView)
// 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, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDrawTextView construction/destruction
CDrawTextView::CDrawTextView()
{
// TODO: add construction code here
}
CDrawTextView::~CDrawTextView()
{
}
BOOL CDrawTextView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CDrawTextView drawing
void CDrawTextView::OnDraw(CDC* pDC)
{
CDrawTextDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CRect rc(100,20,300,200);
CString str = "我爱北京,我爱奥运!";
CBrush brush(RGB(0,0,0,0));
pDC->FrameRect(rc,&brush);
pDC->DrawText(str,rc,DT_CENTER|DT_SINGLELINE|DT_VCENTER);
brush.DeleteObject();
}
/////////////////////////////////////////////////////////////////////////////
// CDrawTextView printing
BOOL CDrawTextView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CDrawTextView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CDrawTextView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CDrawTextView diagnostics
#ifdef _DEBUG
void CDrawTextView::AssertValid() const
{
CView::AssertValid();
}
void CDrawTextView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CDrawTextDoc* CDrawTextView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDrawTextDoc)));
return (CDrawTextDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CDrawTextView message handlers
上一篇:
DrawTextDoc.cpp
下一篇:
科研管理杂志简介