www.pudn.com > subject_1_113294.rar > Arc.cpp, change:2002-05-24,size:1249b
// Arc.cpp: implementation of the CArc class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Paint.h"
#include "Arc.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CArc::CArc():CCircle()
{
End2=CPoint(0,0);
}
CArc::CArc(CPoint Center,CPoint End,CPoint End2):CCircle()
{
this->Center=Center;
this->End=End;
this->End2=End2;
End2=CPoint(0,0);
}
CArc::~CArc()
{
}
void CArc::DrawItem(CDC *pDC)
{
CPen *Pen=new CPen();
CPen *OldPen;
Pen->CreatePen(LineStyle,LineWidth,LineColor);
OldPen=pDC->SelectObject(Pen);
int Radias=(int)sqrt((Center.x-End.x)*(Center.x-End.x)+(Center.y-End.y)*(Center.y-End.y));
CRect rect=CRect();
rect.left=Center.x-Radias;
rect.top=Center.y-Radias;
rect.right=Center.x+Radias;
rect.bottom=Center.y+Radias;
pDC->Arc(rect,End,End2);
}
void CArc::Serialize(CArchive &ar)
{
CCircle::Serialize(ar);
if(ar.IsStoring())
{
ar<<End2;
}
else
{
ar>>End2;
}
}