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

📄 drawsempledoc.cpp

📁 MFC简易绘图
💻 CPP
字号:
// DrawSempleDoc.cpp : implementation of the CDrawSempleDoc class
//

#include "stdafx.h"
#include "DrawSemple.h"

#include "DrawSempleDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDrawSempleDoc

IMPLEMENT_DYNCREATE(CDrawSempleDoc, CDocument)

BEGIN_MESSAGE_MAP(CDrawSempleDoc, CDocument)
	//{{AFX_MSG_MAP(CDrawSempleDoc)
	ON_COMMAND(ID_DRAW_LINE, OnDrawLine)
	ON_COMMAND(ID_DRAW_ELLI, OnDrawElli)
	ON_COMMAND(ID_DRAW_CIRCLE, OnDrawCircle)
	ON_COMMAND(ID_DRAW_RECT, OnDrawRect)
	ON_COMMAND(ID_LINENUM1, OnLinenum1)
	ON_COMMAND(ID_LINENUM2, OnLinenum2)
	ON_COMMAND(ID_LINENUM3, OnLinenum3)
	ON_COMMAND(ID_COLOR1, OnColor1)
	ON_COMMAND(ID_COLOR2, OnColor2)
	ON_COMMAND(ID_COLOR3, OnColor3)
	ON_COMMAND(ID_COLOR5, OnColor5)
	ON_COMMAND(ID_COLOR6, OnColor6)
	ON_COMMAND(ID_COLOR7, OnColor7)
	ON_COMMAND(ID_COLOR8, OnColor8)
	ON_COMMAND(ID_COLOR4, OnColor4)
	ON_COMMAND(ID_TUYUAN_XUAND, OnTuyuanXuand)
	ON_COMMAND(ID_TUYUAN_MOVE, OnTuyuanMove)
	ON_COMMAND(ID_TUYUAN_DELETE, OnTuyuanDelete)
	ON_COMMAND(ID_BRUSH, OnBrush)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDrawSempleDoc construction/destruction
int CDrawSempleDoc::flage=0;
int CDrawSempleDoc::flageline=1;
int CDrawSempleDoc::r=0;
int CDrawSempleDoc::g=0;
int CDrawSempleDoc::b=0;
//bool CDrawSempleDoc::ifxuanding=false;
//bool CDrawSempleDoc::ifdelete=false;
//bool CDrawSempleDoc::ifmove=false;
CDrawSempleDoc::CDrawSempleDoc()
{
	// TODO: add one-time construction code here

}

CDrawSempleDoc::~CDrawSempleDoc()
{
}

BOOL CDrawSempleDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CDrawSempleDoc serialization

void CDrawSempleDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CDrawSempleDoc diagnostics

#ifdef _DEBUG
void CDrawSempleDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CDrawSempleDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CDrawSempleDoc commands

void CDrawSempleDoc::DeleteContents() 
{
	// TODO: Add your specialized code here and/or call the base class
//	flage=0;    //初始化成员变量
	CDocument::DeleteContents();
}

void CDrawSempleDoc::OnDrawLine() 
{
	// TODO: Add your command handler code here
	flage=1;
	UpdateAllViews(NULL);
}

void CDrawSempleDoc::OnDrawElli() 
{
	// TODO: Add your command handler code here
	flage=2;
	UpdateAllViews(NULL);
}

void CDrawSempleDoc::OnDrawCircle() 
{
	// TODO: Add your command handler code here
	flage=3;
	UpdateAllViews(NULL);
}

void CDrawSempleDoc::OnDrawRect() 
{
	// TODO: Add your command handler code here
	flage=4;
	UpdateAllViews(NULL);
}

//DEL int CDrawSempleDoc::Getflage()
//DEL {
//DEL 	return flage;
//DEL }

void CDrawSempleDoc::OnLinenum1() 
{
	// TODO: Add your command handler code here
	flageline=1;
	UpdateAllViews(NULL);
}

void CDrawSempleDoc::OnLinenum2() 
{
	// TODO: Add your command handler code here
	flageline=3;
	UpdateAllViews(NULL);
	
}

void CDrawSempleDoc::OnLinenum3() 
{
	// TODO: Add your command handler code here
	flageline=5;
	UpdateAllViews(NULL);
	
}

void CDrawSempleDoc::OnColor1() 
{
	// TODO: Add your command handler code here
	r=0;
	g=0;
	b=0;
	UpdateAllViews(NULL);
}

void CDrawSempleDoc::OnColor2() 
{
	// TODO: Add your command handler code here
//	rgb=RGB(255,0,0);
	r=255;
	g=0;
	b=0;
	UpdateAllViews(NULL);
	
}

void CDrawSempleDoc::OnColor3() 
{
	// TODO: Add your command handler code here
//	rgb=RGB(0,255,0);
	r=0;
	g=255;
	b=0;
	UpdateAllViews(NULL);
	
}


void CDrawSempleDoc::OnColor5() 
{
	// TODO: Add your command handler code here
//	rgb=RGB(255,255,0);
	r=255;
	g=255;
	b=0;
	UpdateAllViews(NULL);
	
}

void CDrawSempleDoc::OnColor6() 
{
	// TODO: Add your command handler code here
//	rgb=RGB(255,0,255);
	r=255;
	g=0;
	b=255;
	UpdateAllViews(NULL);
	
}

void CDrawSempleDoc::OnColor7() 
{
	// TODO: Add your command handler code here
	r=0;
	g=255;
	b=255;
	UpdateAllViews(NULL);
	
}

void CDrawSempleDoc::OnColor8() 
{
	// TODO: Add your command handler code here
//	rgb=RGB(192,192,192);
	r=192;
	g=192;
	b=192;
	UpdateAllViews(NULL);	
}

void CDrawSempleDoc::OnColor4() 
{
	// TODO: Add your command handler code here
	r=0;
	g=0;
	b=255;
	UpdateAllViews(NULL);
}

void CDrawSempleDoc::OnTuyuanXuand() 
{
	// TODO: Add your command handler code here
//	ifxuanding=true;
	flage=11;
}

void CDrawSempleDoc::OnTuyuanMove() 
{
	// TODO: Add your command handler code here
//	ifmove=true;
	flage=12;
}

void CDrawSempleDoc::OnTuyuanDelete() 
{
	// TODO: Add your command handler code here
//	ifdelete=true;
	flage=13;
}

void CDrawSempleDoc::OnBrush() 
{
	// TODO: Add your command handler code here
	flage=14;
	
}

⌨️ 快捷键说明

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