⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 line.cpp

📁 VC程序设计技巧与实例(2)关于窗口和桌面系统、文件和系统操作、消息影射的原代码
💻 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 + -