📄 myline.cpp
字号:
// MyLine.cpp: implementation of the CMyLine class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "MyDrawBoard.h"
#include "MyLine.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_SERIAL(CMyLine,CObject,1)
CMyLine::CMyLine()
{
}
CMyLine::~CMyLine()
{
}
CMyLine::CMyLine(CPoint startpoint, CPoint endpoint, int penwidth, COLORREF pencolor)
{
m_EndPoint=endpoint;
m_StartPoint=startpoint;
m_PenColor=pencolor;
m_PenWidth=penwidth;
}
void CMyLine::CDrawLine(CDC *pDC)
{
CPen newpen,*oldpen;
newpen.CreatePen(0,m_PenWidth,m_PenColor);
oldpen=pDC->SelectObject(&newpen);
pDC->MoveTo(m_StartPoint);
pDC->LineTo(m_EndPoint);
pDC->SelectObject(oldpen);
}
void CMyLine::Serialize(CArchive &ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
ar<<m_StartPoint;
ar<<m_EndPoint;
ar<<m_PenWidth;
ar<<m_PenColor;
}
else
{
// TODO: add loading code here
ar>>m_StartPoint;
ar>>m_EndPoint;
ar>>m_PenWidth;
ar>>m_PenColor;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -