#pragma once #include class CDC; class CDC; class CCurveEx; class CSigmaDoc; struct HandlePoint; class HandleDrawer { public: HandleDrawer(CSigmaDoc * pDoc); ~HandleDrawer(); bool Init(CCurveEx * pCurve); void ClearAll(CDC * pDC); void DrawAll(CDC * pDC); void ReDrawAll(CDC * pDC); void DrawOneHandle(CDC * pDC, int indexOfHandle); void DrawFocusHandle(CDC * pDC, int indexOfHandle); //返回值:擦除节点的索引 出错或没有焦点Handle 则返回 -1 int EreaseFocusHandle(CDC * pD); protected: void DrawAllOrEreaseAll(CDC * pDC, bool bDrawAll); //bDraw-true 绘制节点 false-擦除节点 bFocus-true 是焦点Handle false-普通Handle void DrawOrEreaseOneHandle(CDC * pDC, HandlePoint * handlePt, bool bDraw, bool bFocus); void DrawHandle(CDC* pDC, HandlePoint * handlePt, bool bFocus); void Release(); private: COLORREF m_colorHandles; COLORREF m_headColor; CSigmaDoc * m_pDoc; HandlePoint * m_focusHandle; std::vector m_handlePts; };