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

📄 line.cpp

📁 Viewdraw 30
💻 CPP
字号:
// Line.cpp: implementation of the CLine class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "test1.h"
#include "Line.h"
#include "Object1.h"

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

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


IMPLEMENT_SERIAL(CLine, CObject1,1);


CLine::CLine()
{

}

CLine::~CLine()
{

}

void CLine::Serialize(CArchive &ar)
	{
	CObject1::Serialize (ar);	
	if (ar.IsStoring())
		{
	   ar << m_ptEndL<< m_ptFirstL;
		}
	else 
		{
	   ar >> m_ptEndL >> m_ptFirstL;
		}
	}


void CLine::Draw(CDC *pDC)
{
		CPen pen (m_nPenType,m_nPenWidth,m_crColor);
//		CPen*pOldPen=pDC->SelectObject(&pen);
		pDC->SelectStockObject(NULL_BRUSH);
		pDC->MoveTo(m_ptFirstL);
		pDC->LineTo(m_ptEndL);
//		pDC->SelectObject(pOldPen);

}

void CLine::GetPoint(CPoint pt1, CPoint pt2)
{
		
	    m_ptFirstL=pt1;
		m_ptEndL=pt2;
}
CPoint CLine::SetFirstPoint()
{
	return m_ptFirstL;
}

CPoint CLine::SetEndPoint()
{
	return m_ptEndL;
}

void CLine::GetPoint2(int x1, int y1, int x2, int y2)
{
	m_ptFirstL.x=x1;
	m_ptFirstL.y=y1;
	m_ptEndL.x=x2;
	m_ptEndL.y=y2;
}

⌨️ 快捷键说明

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