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

📄 eboardview.cpp

📁 电子画图板
💻 CPP
字号:
// eboardView.cpp : implementation of the CEboardView class
//

#include "stdafx.h"
#include "eboard.h"

#include "eboardDoc.h"
#include "eboardView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CEboardView

IMPLEMENT_DYNCREATE(CEboardView, CView)

BEGIN_MESSAGE_MAP(CEboardView, CView)
	//{{AFX_MSG_MAP(CEboardView)
	ON_WM_LBUTTONDOWN()
	ON_COMMAND(ID_MAN_DELALLSHAPE, OnManDelallshape)
	ON_COMMAND(ID_MAN_DELALLSTATEMENT, OnManDelallstatement)
	ON_COMMAND(ID_MAN_DELEBOARD, OnManDeleboard)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CEboardView construction/destruction

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

}

CEboardView::~CEboardView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CEboardView drawing

void CEboardView::OnDraw(CDC* pDC)
{
	CEboardDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	CRect rc;
	GetClientRect(&rc);
	pDoc->m_co.showAxis(pDC,rc.right,rc.bottom);	//显示坐标系
	pDoc->m_co.showShape(pDC);	//显示坐标系上的图形
	pDoc->m_co.showState(pDC);	//显示坐标系上的注视
}

/////////////////////////////////////////////////////////////////////////////
// CEboardView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CEboardView message handlers

void CEboardView::OnLButtonDown(UINT nFlags, CPoint point)	//在视图区单击鼠标左键的消息处理函数
{
	// TODO: Add your message handler code here and/or call default
	CEboardDoc* pDoc = GetDocument();	//获取文档指针
	if(pDoc->m_markState==true){
			pDoc->m_co.addState(point,pDoc->m_statement);	//添加注释
			Invalidate(true);
			pDoc->m_markState=false;
	}
	
	CView::OnLButtonDown(nFlags, point);
}

void CEboardView::OnManDelallshape()	//(按下)“擦去全部图形”菜单项的消息处理函数
{
	// TODO: Add your command handler code here
	if((MessageBox("确定要擦去全部图形吗?","询问",MB_ICONINFORMATION | MB_YESNO))==IDYES){
		CEboardDoc* pDoc = GetDocument();
		pDoc->m_co.delAllShape();	//删去坐标系上的所有图形
		Invalidate(true);	//更新视图
	}
}

void CEboardView::OnManDelallstatement()	//(按下)“擦去全部注释”菜单项的消息处理函数
{
	// TODO: Add your command handler code here
	if((MessageBox("确定要擦去全部注释吗?","询问",MB_ICONINFORMATION | MB_YESNO))==IDYES){
		CEboardDoc* pDoc = GetDocument();
		pDoc->m_co.delAllState();	//删去坐标系上的所有注释
		Invalidate(true);	//更新视图
	}	
}

void CEboardView::OnManDeleboard()		//(按下)“‘擦’黑板”菜单项的消息处理函数
{
	// TODO: Add your command handler code here
	if((MessageBox("确定要擦黑板吗?","询问",MB_ICONINFORMATION | MB_YESNO))==IDYES){
		CEboardDoc* pDoc = GetDocument();
		pDoc->m_co.delAllShape();	//删去坐标系上的所有图形
		pDoc->m_co.delAllState();	//删去坐标系上的所有注释
		Invalidate(true);	//更新视图
	}
}

⌨️ 快捷键说明

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