// MFCHelloCppView.cpp : implementation of the CMFCHelloCppView class
//
#include "stdafx.h"
// SHARED_HANDLERS can be defined in an ATL project implementing preview, thumbnail
// and search filter handlers and allows sharing of document code with that project.
#ifndef SHARED_HANDLERS
#include "MFCHelloCpp.h"
#endif
#include "MFCHelloCppDoc.h"
#include "MFCHelloCppView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMFCHelloCppView
IMPLEMENT_DYNCREATE(CMFCHelloCppView, CView)
BEGIN_MESSAGE_MAP(CMFCHelloCppView, CView)
// 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()
// CMFCHelloCppView construction/destruction
CMFCHelloCppView::CMFCHelloCppView()
{
// TODO: add construction code here
}
CMFCHelloCppView::~CMFCHelloCppView()
{
}
BOOL CMFCHelloCppView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
// CMFCHelloCppView drawing
void CMFCHelloCppView::OnDraw(CDC* /*pDC*/)
{
CMFCHelloCppDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
// TODO: add draw code for native data here
CDC* pDC = GetDC();
CRect rect;
CFont font;
font.CreatePointFont(800, _T("Impact"), pDC);
HFONT pOldFont = HFONT(pDC->SelectObject(HFONT(font)));
GetClientRect(&rect);
pDC->SetTextColor(RGB(128, 128, 128));
pDC->DrawText(_T("Hello C++!"), &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
pDC->SelectObject(pOldFont);
}
// CMFCHelloCppView printing
BOOL CMFCHelloCppView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CMFCHelloCppView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CMFCHelloCppView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
// CMFCHelloCppView diagnostics
#ifdef _DEBUG
void CMFCHelloCppView::AssertValid() const
{
CView::AssertValid();
}
void CMFCHelloCppView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CMFCHelloCppDoc* CMFCHelloCppView::GetDocument() const // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMFCHelloCppDoc)));
return (CMFCHelloCppDoc*)m_pDocument;
}
#endif //_DEBUG
// CMFCHelloCppView message handlers