www.pudn.com > my2cadtest07261930.rar > RectangleTool.cpp, change:2006-07-25,size:957b


 
#include "stdafx.h" 
#include "RectangleTool.h" 
#include "Shape.h" 
#include "Rectangle.h" 
 
extern CList<CShape *> m_list; 
 
CRectangleTool::CRectangleTool(HWND hWnd):CTool(hWnd) 
{ 
 
} 
 
CRectangleTool::~CRectangleTool() 
{ 
 
} 
 
void CRectangleTool::Draw() 
{ 
    ::Rectangle(m_hdc,m_begPT.GetPoint().x,	m_begPT.GetPoint().y, 
		m_endPT.GetPoint().x,m_endPT.GetPoint().y); 
} 
 
void CRectangleTool::PreDraw() 
{	 
	 ::Rectangle(m_hdc,m_begPT.GetPoint().x,m_begPT.GetPoint().y, 
		m_oldPT.GetPoint().x,m_oldPT.GetPoint().y); 
     
	::Rectangle(m_hdc,m_begPT.GetPoint().x,	m_begPT.GetPoint().y, 
		m_endPT.GetPoint().x,m_endPT.GetPoint().y); 
 
	m_oldPT = m_endPT; 
 
} 
 
void CRectangleTool::SaveSelf() 
{ 
 
   CShape *newrect = new CRectangle(m_begPT,m_endPT); 
   newrect->SetLOGPEN(penattrib->GetPenStyle(false)); 
   newrect->SetLOGBRUSH(penattrib->GetBrushStyle(false));  
 
	m_list.AddTail(newrect); 
    m_list.SetEditStatus(true); 
}