line.cpp

来自「实验七 在网络中传输图像:采用C++」· C++ 代码 · 共 45 行

CPP
45
字号
// Line.cpp: implementation of the CLine class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Draw.h"
#include "Line.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CLine::CLine()
{

}

CLine::~CLine()
{

}

CLine::CLine(CPoint ptFrom, CPoint ptTo,COLORREF crColor)
{
	m_ptFrom=ptFrom;
	m_ptTo=ptTo;
	m_crColor=crColor;

}

void CLine::Draw(CDC *PDC)
{
	CPen lpen(PS_SOLID,1,m_crColor);
	CPen* pOldPen=PDC->SelectObject(&lpen);
	PDC->MoveTo(m_ptFrom);
	PDC->LineTo(m_ptTo);
	PDC->SelectObject(pOldPen);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?