Click here to Skip to main content
15,891,828 members
Articles / Desktop Programming / MFC

The Ultimate Toolbox Home Page

Rate me:
Please Sign up or sign in to vote.
4.97/5 (141 votes)
25 Aug 2007CPOL13 min read 3.2M   91.4K   476  
The Ultimate Toolbox is now Open Source
// docktvw.cpp : implementation of the CDocktestView class
//
// Docktest demo of Dockable Views functionality

#include "stdafx.h"
#include "docktest.h"

#include "docktdoc.h"
#include "docktvw.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDocktestView

IMPLEMENT_DYNCREATE(CDocktestView, CView)

BEGIN_MESSAGE_MAP(CDocktestView, CView)
	//{{AFX_MSG_MAP(CDocktestView)
		// 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_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDocktestView construction/destruction

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

}

CDocktestView::~CDocktestView()
{
}

/////////////////////////////////////////////////////////////////////////////
// CDocktestView drawing

void CDocktestView::OnDraw(CDC* pDC)
{
	CDocktestDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	CRect rectClient, rect;
	CString sMsg;
//	int nNewLines, i;

	sMsg = _T("Do you like the current Visual C++ IDE ?\nTry to move everything around and see for yourself\nNote the toolbar in this MDIChild Frame");

	GetClientRect(&rectClient);
//	CSize szText = pDC->GetTextExtent(message);
	pDC->DrawText(sMsg, rectClient, DT_CENTER | DT_VCENTER);
}

/////////////////////////////////////////////////////////////////////////////
// CDocktestView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CDocktestView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CDocktestView 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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Canada Canada
In January 2005, David Cunningham and Chris Maunder created TheUltimateToolbox.com, a new group dedicated to the continued development, support and growth of Dundas Software’s award winning line of MFC, C++ and ActiveX control products.

Ultimate Grid for MFC, Ultimate Toolbox for MFC, and Ultimate TCP/IP have been stalwarts of C++/MFC development for a decade. Thousands of developers have used these products to speed their time to market, improve the quality of their finished products, and enhance the reliability and flexibility of their software.
This is a Organisation

476 members

Comments and Discussions