?? myline.cpp
字號:
// MyLine.cpp: implementation of the CMyLine class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "MyDrawBoard.h"
#include "MyLine.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
IMPLEMENT_SERIAL(CMyLine,CObject,1)
CMyLine::CMyLine()
{
}
CMyLine::~CMyLine()
{
}
CMyLine::CMyLine(CPoint startpoint, CPoint endpoint, int penwidth, COLORREF pencolor)
{
m_EndPoint=endpoint;
m_StartPoint=startpoint;
m_PenColor=pencolor;
m_PenWidth=penwidth;
}
void CMyLine::CDrawLine(CDC *pDC)
{
CPen newpen,*oldpen;
newpen.CreatePen(0,m_PenWidth,m_PenColor);
oldpen=pDC->SelectObject(&newpen);
pDC->MoveTo(m_StartPoint);
pDC->LineTo(m_EndPoint);
pDC->SelectObject(oldpen);
}
void CMyLine::Serialize(CArchive &ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
ar<<m_StartPoint;
ar<<m_EndPoint;
ar<<m_PenWidth;
ar<<m_PenColor;
}
else
{
// TODO: add loading code here
ar>>m_StartPoint;
ar>>m_EndPoint;
ar>>m_PenWidth;
ar>>m_PenColor;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -