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

📄 line.cpp

📁 这是一个小型画板系统
💻 CPP
字号:
// Line.cpp: implementation of the CLine class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "paint.h"
#include "Line.h"

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

IMPLEMENT_SERIAL(CLine,CObject,1)
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CLine::CLine()
{
	pntStart=CPoint(0,0);
	pntEnd = CPoint(0,0);
	
}

CLine::CLine(CPoint ptFrom,CPoint ptTo,COLORREF color)
{
	pntStart=ptFrom;
	pntEnd=ptTo;
	pntColor=color;
}

CLine::~CLine()
{

}

void CLine::Draw(CDC *pDC)
{
	CPen lpen(PS_SOLID,1,pntColor);
	CPen *pOldPen=pDC->SelectObject(&lpen);
	pDC->SetROP2(R2_NOTXORPEN );		    //如果有旧线条就覆盖  
	pDC->MoveTo(pntStart);
	pDC->LineTo(pntEnd);
}

void CLine::Move(int xOffset, int yOffset)
{
	
}

void CLine::Serialize(CArchive &ar)
{
	CShape::Serialize(ar);
	if(ar.IsStoring())
	{
		ar<<pntStart<<pntEnd<<(DWORD)pntColor;
	}
	else
	{
		ar>>pntStart>>pntEnd>>(DWORD)pntColor;
	}
}

⌨️ 快捷键说明

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