📄 line.cpp
字号:
// Line.cpp: implementation of the CLine class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Mouse.h"
#include "Line.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
//无参数构造函数
CLine::CLine()
{
m_nStartPnt = CPoint(0, 0);
m_nEndPnt = CPoint(0, 0);
}
//析构函数
CLine::~CLine()
{
}
//拷贝构造函数
CLine::CLine(const CLine& other)
{
m_nStartPnt = other.m_nStartPnt;
m_nEndPnt = other.m_nEndPnt;
}
//赋值函数
CLine & CLine::operator=(const CLine& other)
{
if (this == &other)
return *this;
m_nStartPnt = other.m_nStartPnt;
m_nEndPnt = other.m_nEndPnt;
return *this;
}
//画直线段
void CLine::Draw(CDC* pDC)
{
pDC->MoveTo(m_nStartPnt);
pDC->LineTo(m_nEndPnt);
}
//设置起点
void CLine::SetStartPnt(CPoint point)
{
m_nStartPnt = point;
}
//设置终点
void CLine::SetEndPnt(CPoint point)
{
m_nEndPnt = point;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -