Click here to Skip to main content
15,883,705 members
Articles / Desktop Programming / MFC

Develop MFC Doc/View Application Which Supports Any Number Document Template

Rate me:
Please Sign up or sign in to vote.
1.57/5 (3 votes)
2 Jun 20052 min read 36.4K   1.7K   26  
This article provides an introduction to TangramLittle, a C++ Framework for MFC and the .NET Framework. Knowledge in MFC and the .NET Framework is assumed.
// DotNetMfcView.cpp : implementation of the CDotNetMfcView class
//

#include "stdafx.h"
#include "DocTemplate2.h"

#include "DocTemplate2Doc.h"
#include "DocTemplate2View.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CDocTemplate2View

IMPLEMENT_DYNCREATE(CDocTemplate2View, CView)

BEGIN_MESSAGE_MAP(CDocTemplate2View, 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()

// CDocTemplate2View construction/destruction

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

}

CDocTemplate2View::~CDocTemplate2View()
{
}

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

	return CView::PreCreateWindow(cs);
}

// CDocTemplate2View drawing

void CDocTemplate2View::OnDraw(CDC* /*pDC*/)
{
	CDocTemplate2Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	// TODO: add draw code for native data here
}


// CDocTemplate2View printing

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

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

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


// CDocTemplate2View diagnostics

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

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

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


// CDocTemplate2View message handlers

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here



Comments and Discussions