////////////////////////////////////////////////////////////////////////////// //文件: CItem类扩展 //主要功能: // 操作各类元素或完成一定的功能 // //程序编写: 2006-12-07 // // ///////////////////////////////////////////////////////////////////////////// #pragma once #include "item.h" namespace NItem { #define TRACKER_SOLID 1 #define TRACKER_RECT 2 #define TRACKER_CIRCLE 4 #define TRACKER_NO_EDIT TRACKER_SOLID | TRACKER_CIRCLE class CItemTracker : public CItem { public: enum Handle { HandleTopLeft = 0, HandleTop = 1, HandleTopRight = 2, HandleRight = 3, HandleBottomRight = 4, HandleBottom = 5, HandleBottomLeft = 6, HandleLeft = 7, HandleCenter = 8, HandleBody = 9, HandleNothing = -1 }; CItemTracker(void); CItemTracker(CSigmaDoc * ppDoc); virtual ~CItemTracker(void); COLORREF m_colorMark; // color of Marking Rectangle. Default: light gray. COLORREF m_colorHandles; // color of handles on corners and edges. Default: black. COLORREF m_colorHandlesEnableBrush; COLORREF m_colorHandlesDisableBursh; COLORREF m_colorCenter; // color of center. Default: black. COLORREF m_colorTrack; // color of Tracking Rectangle. Default: black. UINT m_HandleSize; UINT m_InnerMargin; UINT m_OuterMargin; CRect m_rect; CPoint m_CenterPoint; DWORD m_nDrawMode; int m_HandleSizeFocus; void SetRect(const CRect rect); CRect GetTrueRect(); int HitTest(CPoint point); CPoint GetHandlePoint(int iHandle); CSize GetHandleSize(void); CRect GetHandleRect(int iHandle); CRect GetHandleRect(CPoint point); CRect GetHandleRect(long x,long y); CRect GetHandleRectFocus(CPoint point); CRect GetHandleRectFocus(long x,long y); int GetHandleSizeFocus(void); BOOL IsCanNotEdit(void); DWORD SetDrawMode(DWORD nDrawMode); DWORD GetDrawMode(void); void DrawTracker(CDC* pDC); void DrawHandle(CDC* pDC, DWORD nDrawMode); void DrawHandle(CDC* pDC, CRect& rect, DWORD nDrawMode); void DrawCenter(CDC * pDC, POINT center, bool bTrack, bool bCenterMove); void DrawMark(CDC* pDC, CRect rect, BOOL bIsDot); void Initial(void); }; };