www.pudn.com > MyDraw1225.rar > Rectangle.cpp


// Rectangle.cpp: implementation of the CRectangle class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#include "stdafx.h" 
#include "MyDraw.h" 
#include "Rectangle.h" 
 
#ifdef _DEBUG 
#undef THIS_FILE 
static char THIS_FILE[]=__FILE__; 
#define new DEBUG_NEW 
#endif 
 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
////////////////////////////////////////////////////////////////////// 
IMPLEMENT_SERIAL(CRectangle,CObject,1) 
 
CRectangle::CRectangle() 
{ 
	bIsSelected=0; 
	startX=0; 
	startY=0; 
	endX=100; 
	endY=100; 
 
	LinePen.lopnWidth.x=3; 
	LinePen.lopnColor=RGB(0,0,0); 
	LinePen.lopnStyle=PS_SOLID; 
 
	MyBrush.lbColor=RGB(255,255,255); 
	MyBrush.lbHatch=HS_CROSS; 
	MyBrush.lbStyle=BS_NULL; 
} 
 
CRectangle::~CRectangle() 
{ 
 
} 
 
void CRectangle::Serialize(CArchive & ar) 
{ 
	CObject::Serialize(ar); 
    if(ar.IsLoading()) 
    { 
		ar>>startX>>startY>>endX>>endY>> 
			LinePen.lopnWidth.x>>LinePen.lopnColor>>LinePen.lopnStyle>> 
			MyBrush.lbColor>>MyBrush.lbHatch>>MyBrush.lbStyle;   
    } 
	else 
	{ 
        ar<