|
// mfcdxView.cpp : implementation of the CMfcdxView class
//
#include "stdafx.h"
#include "mfcdx.h"
#include "mfcdxDoc.h"
#include "..\DXSurfaceMgr.h"
#include "mfcdxView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMfcdxView
IMPLEMENT_DYNCREATE(CMfcdxView, CView)
BEGIN_MESSAGE_MAP(CMfcdxView, CView)
//{{AFX_MSG_MAP(CMfcdxView)
ON_WM_CREATE()
ON_WM_ERASEBKGND()
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CMfcdxView construction/destruction
CMfcdxView::CMfcdxView()
{
// TODO: add construction code here
}
CMfcdxView::~CMfcdxView()
{
}
BOOL CMfcdxView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMfcdxView drawing
void CMfcdxView::OnDraw(CDC* pDC)
{
CMfcdxDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
HDC& hdc = dxMgr_.BeginPaint(GetSysColor(COLOR_3DFACE));
if(NULL !=hdc)
{
::SetBkMode(hdc,TRANSPARENT);
CRect client; GetClientRect(&client);
filllines(hdc, client, RGB(128, 128, 128));
CDC* cdc = CDC::FromHandle(hdc);
CPen p(PS_DASHDOTDOT, 1, RGB(128, 128, 128));
CPen* op = cdc->SelectObject(&p);
cdc->MoveTo(30, 87);
cdc->LineTo(client.Width()-20, client.Height() - 30);
cdc->SetBkMode(TRANSPARENT);
cdc->TextOut(20, 20, "double buffering in directx", 27);
cdc->SelectObject(op);
dxMgr_.EndPaint();
}
}
/////////////////////////////////////////////////////////////////////////////
// CMfcdxView printing
BOOL CMfcdxView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CMfcdxView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CMfcdxView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CMfcdxView diagnostics
#ifdef _DEBUG
void CMfcdxView::AssertValid() const
{
CView::AssertValid();
}
void CMfcdxView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CMfcdxDoc* CMfcdxView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMfcdxDoc)));
return (CMfcdxDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMfcdxView message handlers
int CMfcdxView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
if(!dxMgr_.Initialise(m_hWnd)) return -1;
return 0;
}
BOOL CMfcdxView::OnEraseBkgnd(CDC* pDC)
{
return -1;
}
|
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.