graphline.cpp

来自「一个简单的画图程序 可以画点线面等」· C++ 代码 · 共 80 行

CPP
80
字号
// GraphLine.cpp: implementation of the CGraphLine class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "SmallCAD203.h"
#include "GraphLine.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CGraphLine::CGraphLine():m_startPoint(0,0),m_endPoint(0,0)
{
	nflag=5;
	//m_startPoint;
	 //m_endPoint;
	
}

CGraphLine::~CGraphLine()
{

}

void CGraphLine::SetStartPoint(CPoint point)
{
	m_startPoint=point;

}

CPoint CGraphLine::GetStartPoint()
{
	return m_startPoint;

}

void CGraphLine::SetEndPoint(CPoint point)
{
	m_endPoint=point;

}

CPoint CGraphLine::GetEndPoint()
{
	return m_endPoint;

}

void CGraphLine::Draw(CDC *pDC)
{
	CPen pen;
	pen.CreatePen(PS_SOLID,m_scale,m_color);
	pDC->SelectStockObject(NULL_BRUSH);
	pDC->SelectObject(&pen);
	pDC->MoveTo(m_startPoint);
	pDC->LineTo(m_endPoint);

}

void CGraphLine::Serialize(CArchive& ar)
{

	if(ar.IsStoring())
	{
		ar<<this->m_startPoint<<this->m_endPoint;
	}
	else
	{
		ar>>this->m_startPoint>>this->m_endPoint;
	}
}

⌨️ 快捷键说明

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