www.pudn.com > PercentageCtrl.rar > PercentageCtrl.h
#if !defined(AFX_PERCENTAGECTRL1_H__B2232FDF_B2DA_47B1_8F0F_99CF751DAE0C__INCLUDED_) #define AFX_PERCENTAGECTRL1_H__B2232FDF_B2DA_47B1_8F0F_99CF751DAE0C__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // PercentageCtrl1.h : header file // #include#define PC_HORIZONTAL 0 //default #define PC_VERTICAL 1 #define PC_VERTICALTEXT 2 #define PC_HORIZONTALTEXT 0 //default #define PC_READONLY 4 #define PC_ALWAYSSHOWTEXT 8 #define PC_TEXTELLIPSIS 16 ///////////////////////////////////////////////////////////////////////////// // CPercentageCtrl window class CPercentageCtrl; struct PercentageData { COLORREF color; COLORREF textcolor; UINT original; double normalized; CString text; PercentageData(UINT pc=0, CString txt="", COLORREF c=RGB(0,0,0)); }; class CPercentageCtrl : public CWnd { CArray m_percentagedata; int m_TrackIndex; UINT m_TrackOrigData1; double m_TrackOrigNormalizedData1; UINT m_TrackOrigData2; double m_TrackOrigNormalizedData2; BOOL m_Tracking; double m_multiplier; int m_options; // Construction public: CPercentageCtrl(); // Attributes public: // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CPercentageCtrl) //}}AFX_VIRTUAL // Implementation public: int GetBlockCount(); double GetMultiplier(); BOOL RemoveBlock(int index); void SetMultiplier(double multiplier); double GetPercentage(int index); UINT GetWeight(int index); void SetOptions(int options); BOOL ReplaceBlock(UINT weight, CString format, int pos, COLORREF c = RGB(0,0,0)); BOOL InsertBlock(UINT weight, CString format, int pos, COLORREF c = RGB(0,0,0)); int AddBlock(UINT weight, CString format="", COLORREF c = RGB(0,0,0)); virtual ~CPercentageCtrl(); // Generated message map functions protected: void Normalize(); //{{AFX_MSG(CPercentageCtrl) afx_msg void OnPaint(); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg BOOL OnEraseBkgnd( CDC* pDC ); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_PERCENTAGECTRL1_H__B2232FDF_B2DA_47B1_8F0F_99CF751DAE0C__INCLUDED_)