⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 drawexamview.cpp

📁 图形绘制功能
💻 CPP
字号:
// DrawExamView.cpp : implementation of the CDrawExamView class
//

#include "stdafx.h"
#include "DrawExam.h"

#include "DrawExamDoc.h"
#include "DrawExamView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDrawExamView

IMPLEMENT_DYNCREATE(CDrawExamView, CView)

BEGIN_MESSAGE_MAP(CDrawExamView, CView)
	//{{AFX_MSG_MAP(CDrawExamView)
	ON_WM_LBUTTONUP()
	ON_WM_LBUTTONDOWN()
	ON_WM_PAINT()
	ON_WM_MOUSEMOVE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDrawExamView construction/destruction

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

}

CDrawExamView::~CDrawExamView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CDrawExamView drawing

void CDrawExamView::OnDraw(CDC* pDC)
{
	CDrawExamDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

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

/////////////////////////////////////////////////////////////////////////////
// CDrawExamView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CDrawExamView message handlers

void CDrawExamView::DrawLine(CPoint firstPoint, CPoint lastPoint, CPoint currentPoint)
{

}

void CDrawExamView::OnLButtonUp(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	if (m_bBeginDraw)
	{
		switch(m_drawID) 
		{
		case 0 :
			break;
		case 1 :
			{
				DrawLine(m_firstPoint,m_lastPoint);
				m_lastPoint = point;
				break;
			}
		case 2 :
			{
				break;
			}
		default:
			break;
		}
	}
	CView::OnLButtonUp(nFlags, point);
}

void CDrawExamView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default

	
	m_bBeginDraw = TRUE;
	m_firstPoint =  point;
	m_lastPoint = point;
	SetCapture();

	CView::OnLButtonDown(nFlags, point);
}

void CDrawExamView::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	
	CView::OnMouseMove(nFlags, point);
}

void CDrawExamView::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	
	// Do not call CView::OnPaint() for painting messages
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -