www.pudn.com > subject_1_113294.rar > Ellisp.cpp, change:2002-05-23,size:1678b
// Ellisp.cpp: implementation of the CEllisp class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Paint.h"
#include "Ellisp.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CEllisp::CEllisp():CRectangle()
{
}
CEllisp::CEllisp(int Left,int Top,int Right,int Bottom):CRectangle()
{
this->LeftTop.x=Left;
this->LeftTop.y=Top;
this->RightBottom.x=Right;
this->RightBottom.y=Bottom;
}
CEllisp::CEllisp(CPoint LeftTop,CPoint RightBottom):CRectangle()
{
this->LeftTop-LeftTop;
this->RightBottom=RightBottom;
}
CEllisp::~CEllisp()
{
}
void CEllisp::Serialize(CArchive &ar)
{
CRectangle::Serialize(ar);
}
void CEllisp::DrawItem(CDC *pDC)
{
CPen *Pen=new CPen();
CPen *OldPen;
Pen->CreatePen(LineStyle,LineWidth,LineColor);
OldPen=pDC->SelectObject(Pen);
CBrush *Brush=new CBrush();
CBrush *OldBrush;
if(!IsFilled)
{
Brush->CreateStockObject(NULL_BRUSH);
OldBrush=pDC->SelectObject(Brush);
}
else if(FillMode==-1)
{
Brush->CreateSolidBrush(FillColor);
OldBrush=pDC->SelectObject(Brush);
}
else
{
Brush->CreateHatchBrush(FillMode,FillColor);
OldBrush=pDC->SelectObject(Brush);
}
int x1=LeftTop.x;
int y1=LeftTop.y;
int x2=RightBottom.x;
int y2=RightBottom.y;
pDC->Ellipse(x1,y1,x2,y2);
pDC->SelectObject(OldPen);
pDC->SelectObject(OldBrush);
delete Brush;
delete Pen;
}