www.pudn.com > mischat.rar > Draw.h
// Line.h: interface for the CLine class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_LINE_H__B8A89174_F539_4C3F_AB0C_A77AD94597E9__INCLUDED_)
#define AFX_LINE_H__B8A89174_F539_4C3F_AB0C_A77AD94597E9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "DrawTypeId.h"
class CDraw : public CObject
{
public:
CDraw();
virtual ~CDraw();
virtual void Draw(CDC* pDC)=0;
virtual void Serialize(CArchive& ar)=0;
virtual bool HitTest(CPoint& pt,CDC* pDC=NULL)=0;
virtual CRect GetOutside(CDC* pDC=NULL)=0;
virtual void Offset(CSize& s)=0;
bool IsOnline(CPoint& pFrom,CPoint& pTo,CPoint& pTest);
bool IsOnRect(CRect& rect,CPoint& pTest);
};
class CCurve : public CDraw
{
DECLARE_SERIAL(CCurve)
public:
void Draw(CDC* pDC);
void Serialize(CArchive& ar);
CCurve();
virtual ~CCurve();
void AddPoint(CPoint point);
void Init(UINT w=1,COLORREF c=RGB(0,0,0));
bool HitTest(CPoint& pt,CDC* pDC=NULL);
CRect GetOutside(CDC* pDC=NULL);
void Offset(CSize& s);
UINT m_width;
COLORREF m_crColor;
private:
CList pointList;
};
class CLine : public CDraw
{
DECLARE_SERIAL(CLine)
public:
void Draw(CDC* pDC);
void Serialize(CArchive& ar);
CLine(CPoint ptFrom,CPoint ptTo,COLORREF crColor=RGB(0,0,0),UINT width=1);
CLine();
virtual ~CLine();
bool HitTest(CPoint& pt,CDC* pDC=NULL);
CRect GetOutside(CDC* pDC=NULL);
void Offset(CSize& s);
UINT m_width;
COLORREF m_crColor;
private:
CPoint m_ptFrom;
CPoint m_ptTo;
};
class CText : public CDraw
{
DECLARE_SERIAL(CText)
public:
void Draw(CDC* pDC);
void Serialize(CArchive& ar);
CText(CPoint ptFrom,CString strText,LOGFONT lf,COLORREF crColor=RGB(0,0,0));
CText();
virtual ~CText();
bool HitTest(CPoint& pt,CDC* pDC=NULL);
CRect GetOutside(CDC* pDC=NULL);
void Offset(CSize& s);
COLORREF m_crColor;
LOGFONT m_lf;//文本字体
CString m_strText;
private:
CPoint m_ptFrom;
};
class CRectangle : public CDraw
{
DECLARE_SERIAL(CRectangle)
public:
void Draw(CDC* pDC);
void Serialize(CArchive& ar);
CRectangle(CRect rect,COLORREF crPen=RGB(0,0,0),COLORREF crBrush=RGB(255,255,255),UINT width=1,int shape=RECTANGLE);
CRectangle();
virtual ~CRectangle();
bool HitTest(CPoint& pt,CDC* pDC=NULL);
CRect GetOutside(CDC* pDC=NULL);
void Offset(CSize& s);
int DrawShape;
UINT m_width;
COLORREF m_crPen,m_crBrush;
private:
CRect m_rect;
};
class CEllipse : public CDraw
{
DECLARE_SERIAL(CEllipse)
public:
void Draw(CDC* pDC);
void Serialize(CArchive& ar);
CEllipse(CRect rect,COLORREF crPen=RGB(0,0,0),COLORREF crBrush=RGB(255,255,255),UINT width=1,int shape=ELLIPSE);
CEllipse();
virtual ~CEllipse();
bool HitTest(CPoint& pt,CDC* pDC=NULL);
CRect GetOutside(CDC* pDC=NULL);
void Offset(CSize& s);
int DrawShape;
UINT m_width;
COLORREF m_crPen,m_crBrush;
private:
CRect m_rect;
};
#endif // !defined(AFX_LINE_H__B8A89174_F539_4C3F_AB0C_A77AD94597E9__INCLUDED_)
// CDraw 命令目标