graphpoint.cpp
来自「一个简单的画图程序 可以画点线面等」· C++ 代码 · 共 74 行
CPP
74 行
// GraphPoint.cpp: implementation of the CGraphPoint class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "SmallCAD203.h"
#include "GraphPoint.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CGraphPoint::CGraphPoint()
{
nflag=2;
x=0;
y=0;
}
CGraphPoint::~CGraphPoint()
{
}
void CGraphPoint::SetLocation(int x, int y)
{
this->x=x;
this->y=y;
}
void CGraphPoint::SetLocation(CPoint point)
{
x=point.x;
y=point.y;
}
CPoint CGraphPoint::GetLocation()
{
return CPoint(x,y);
}
void CGraphPoint::Draw(CDC *pDC)
{
CPen pen;
pen.CreatePen(PS_SOLID,1,m_color);
pDC->SelectStockObject(NULL_BRUSH);
pDC->SelectObject(&pen);
pDC->Ellipse(x-m_scale,y-m_scale,x+m_scale,y+m_scale);
}
void CGraphPoint::Serialize(CArchive& ar)
{
if(ar.IsStoring())
{
ar<<x<<y;
}
else
{
ar>>this->x>>this->y;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?