www.pudn.com > MFCVista.rar > ICheckBox.h


#pragma once 
//CheckBox控件 
#include "imagelist.h" 
#include "Iontrlpos.h" 
class AFX_EXT_CLASS CICheckBox : public CButton,public CImageListEx,public CIontrlPos 
{ 
	DECLARE_DYNAMIC(CICheckBox) 
public: 
	CICheckBox(); 
	virtual ~CICheckBox(); 
protected: 
	DECLARE_MESSAGE_MAP() 
public: 
	bool m_bEnable, 
		 m_bState, 
		 m_bShow; 
	CToolTipCtrl	m_CToolTip;	//工具提示 
	void SetAtt(UINT bmp,bool state=0,char *text=0,COLORREF  textcolor=0,COLORREF tran=0); 
	void enable(bool); 
	void show(bool); 
	void SetText(CString); 
	void SetStateBmp(bool); 
	void SetTextColor(COLORREF); 
	void SetCheck(bool); 
	bool GetCheck(); 
	void SetCursor(UINT id); 
	void SetCursor(HCURSOR id);	 
	void SetToolTip(LPCSTR cText=0,COLORREF TextClr=RGB(0,128,64),COLORREF BKClr=RGB(255,255,255),DWORD dwTime=100); 
private: 
	COLORREF	m_COLORREFMask, 
				m_COLORREFText; 
	CString		m_strText; 
	int			m_index, 
				m_iOldIndex; 
	CPoint		m_CPointOldMouse, 
				m_CPointMouse; 
	HCURSOR		m_hCursor; 
	CRect		m_CRect; 
protected: 
	bool		m_bMouseDown; 
	CFont		m_CFont; 
public: 
	afx_msg void OnTimer(UINT nIDEvent); 
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point); 
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point); 
	afx_msg void OnPaint(); 
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); 
	afx_msg BOOL OnEraseBkgnd(CDC* pDC); 
protected: 
	virtual void DrawText(CPaintDC *,CString text,COLORREF textcolor); 
	virtual	void DrawButton(CPaintDC *pDC,UINT iRow,UINT iColumn,COLORREF *Mack,int iLeft,int iTop);//系统正为按钮贴图 
	virtual void DrawItem(LPDRAWITEMSTRUCT); 
	virtual BOOL PreTranslateMessage(MSG* pMsg); 
};