www.pudn.com > DrawTrend.zip > CyPaintBox.h


//--------------------------------------------------------------------------- 
 
#ifndef CyPaintBoxH 
#define CyPaintBoxH 
//--------------------------------------------------------------------------- 
//#include  
//#include  
//#include  
//#include  
//#include  
//--------------------------------------------------------------------------- 
class TCyPaintBox 
{ 
private: 
    HPEN    m_hPen; 
    HBRUSH  m_hBrush; 
 
public: 
    int m_iLeft, m_iTop, m_iWidth, m_iHeight; 
 
    CFont * m_pstFont; 
    COLORREF XBackColor; 
protected: 
    HDC     m_hDC; 
 
    void   SetXBackColor(COLORREF color); 
public: 
    TCyPaintBox(); 
    ~TCyPaintBox(); 
 
    void SetDC(HDC hdc){m_hDC = hdc;}; 
    COLORREF GetXBackColor(); 
public: 
    void Line(CPoint start, CPoint end, COLORREF color); 
    void LineTo(CPoint end, COLORREF color); 
    void Rect(RECT rect, bool filled, COLORREF color); 
    void Rect(CPoint start, CPoint end, bool filled, COLORREF color); 
    void Rect(int left, int top, int width, int height, bool filled, COLORREF color); 
 
    void SetTextFont(CFont * font); 
    void TextOut(CPoint start, char *str, COLORREF color); 
    void TextOut(int x, int y, char *str, COLORREF color); 
    void TextOut(int x, int y, char * str, COLORREF color, char * szFontName, int iFontSize); 
//    int  TextWidth(char *sz){return strlen(sz) * m_pstFont->Size;}; 
}; 
//--------------------------------------------------------------------------- 
#endif