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

📄 809view.cpp

📁 mfc制作的画板 并具有源代码很有应用价值 适合初学者
💻 CPP
字号:
// 809View.cpp : implementation of the CMy809View class
//

#include "stdafx.h"
#include "809.h"

#include "809Doc.h"
#include "809View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMy809View

IMPLEMENT_DYNCREATE(CMy809View, CView)

BEGIN_MESSAGE_MAP(CMy809View, CView)
	//{{AFX_MSG_MAP(CMy809View)
	ON_WM_LBUTTONDOWN()
	ON_WM_LBUTTONUP()
	ON_WM_MOUSEMOVE()
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CMy809View construction/destruction

CMy809View::CMy809View()
{
	// TODO: add construction code here
    p1=0;
	bl=FALSE;
}

CMy809View::~CMy809View()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMy809View drawing

void CMy809View::OnDraw(CDC* pDC)
{
	CMy809Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CMy809View printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMy809View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMy809View message handlers

void CMy809View::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
//	MessageBox("dianji");
	p1=point;
    bl=TRUE;
	CView::OnLButtonDown(nFlags, point);
}

void CMy809View::OnLButtonUp(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	bl=FALSE;
	CView::OnLButtonUp(nFlags, point);
}

void CMy809View::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	CClientDC  dc(this);
	CPen pen(PS_SOLID,1,RGB(255,0,0));
    CPen *p=dc.SelectObject(&pen);
	if(bl==TRUE)
	{
		dc.MoveTo(p1);
		dc.LineTo(point);
		p1=point;
	}
   dc.SelectObject(p);
	CView::OnMouseMove(nFlags, point);
}

⌨️ 快捷键说明

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