📄 rectangle.cpp
字号:
// Rectangle.cpp: implementation of the CRectangle class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "画图.h"
#include "Rectangle.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_SERIAL(CRectangle,CObject,1)
CRectangle::CRectangle()
{
start=end=CPoint(0,0);
width=1;
color=RGB(0,0,255);
}
CRectangle::~CRectangle()
{
}
CRectangle::CRectangle(CPoint p1, CPoint p2, int w,COLORREF c)
{
start=p1;
end=p2;
width=2;
color=c;
}
void CRectangle::Serialize(CArchive &ar)
{
if(ar.IsStoring())
ar<<start<<end<<width<<color;
else
ar>>start>>end>>width>>color;
}
CPoint CRectangle::GetStart()
{
return start;
}
CPoint CRectangle::GetEnd()
{
return end;
}
void CRectangle::SetStart(CPoint p)
{
start=p;
}
void CRectangle::SetEnd(CPoint p)
{
end=p;
}
void CRectangle::SetWidth(int w)
{
width=w;
}
int CRectangle::GetWidth()
{
return width;
}
COLORREF CRectangle::GetColor()
{
return color;
}
void CRectangle::SetColor(COLORREF c)
{
color=c;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -