graphrectangle.cpp
来自「一个简单的画图程序 可以画点线面等」· C++ 代码 · 共 71 行
CPP
71 行
// GraphRectangle.cpp: implementation of the CGraphRectangle class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "GraphRectangle.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CGraphRectangle::CGraphRectangle():m_point1(0,0),m_point2(0,0)
{
nflag=3;
a=0;
}
CGraphRectangle::~CGraphRectangle()
{
}
void CGraphRectangle::SetPoint1(CPoint point)
{
m_point1=point;
}
CPoint CGraphRectangle::GetPoint1()
{
return m_point1;
}
void CGraphRectangle::SetPoint2(CPoint point)
{
m_point2=point;
}
CPoint CGraphRectangle::GetPoint2()
{
return m_point2;
}
void CGraphRectangle::Draw(CDC *pDC)
{
CPen pen;
pen.CreatePen(PS_SOLID,m_scale,m_color);
pDC->SelectStockObject(NULL_BRUSH);
pDC->SelectObject(&pen);
pDC->Rectangle(m_point1.x,m_point1.y,m_point2.x,m_point2.y);
}
void CGraphRectangle::Serialize(CArchive& ar)
{
if(ar.IsStoring())
{
ar<<this->m_point1<<this->m_point2;
}
else
{
ar>>this->m_point1>>this->m_point2;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?