www.pudn.com > GGBT.rar > ButtonEx.h


#if !defined(AFX_BUTTONEX_H__53063543_3E40_4B91_A607_A78E280DDBA2__INCLUDED_) 
#define AFX_BUTTONEX_H__53063543_3E40_4B91_A607_A78E280DDBA2__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
// ButtonEx.h : header file 
// 
 
///////////////////////////////////////////////////////////////////////////// 
// CButtonEx window 
 
class CButtonEx : public CButton 
{ 
// Construction 
public: 
	CButtonEx(); 
 
// Attributes 
public: 
 
// Operations 
public: 
	bool Create(HICON hIcon= 0, bool bIconOnly = false, CString strTipText = CString()); 
 
// Overrides 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CButtonEx) 
	public: 
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); 
	virtual BOOL PreTranslateMessage(MSG* pMsg); 
	//}}AFX_VIRTUAL 
 
// Implementation 
public: 
	virtual ~CButtonEx(); 
 
	// Generated message map functions 
protected: 
	//{{AFX_MSG(CButtonEx) 
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 
	afx_msg BOOL OnEraseBkgnd(CDC* pDC); 
	//}}AFX_MSG 
	afx_msg void OnMouseMove(UINT nFlags, CPoint point); 
	afx_msg LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam); 
	afx_msg LRESULT OnMouseHover(WPARAM wParam, LPARAM lParam); 
	DECLARE_MESSAGE_MAP() 
private: 
	void _DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); 
	void RoundRectExK(CDC& dc, const CRect rc, const CPoint& pt, COLORREF itl, COLORREF ibr); 
	void DrawTheIcon(CDC* pDC, CString* title, RECT* rcItem, BOOL IsPressed, BOOL IsDisabled); 
 
	BOOL m_bOver; 
	BOOL m_bTracking; 
	BOOL m_bSelected; 
	BOOL m_bFocus; 
 
	long m_cxIcon; 
	long m_cyIcon; 
	HICON m_hIcon; 
	bool m_bIconOnly; 
 
	CToolTipCtrl m_tip; 
	CString m_strTipText; 
	BOOL	m_bTiping; 
 
	 
	class CMemDC : public CDC 
	{ 
	public: 
		CDC*	     m_dc; 
		CBitmap      m_bitmap; 
		CBitmap*	 m_hOldBitmap; 
		RECT         m_rc; 
		 
		CMemDC(HDC hDC, LPRECT pRect) 
		{ 
			m_dc = new CDC; 
			 
			ASSERT(hDC != NULL); 
			m_dc->m_hAttribDC = hDC; 
			m_dc->m_hDC = hDC; 
			if (pRect != NULL) 
				m_rc = *pRect; 
			else 
				m_dc->GetClipBox(&m_rc); 
			 
			CreateCompatibleDC(m_dc); 
			::LPtoDP(m_dc->m_hDC, (LPPOINT)&m_rc, sizeof(RECT) / sizeof(POINT)); 
			m_bitmap.CreateCompatibleBitmap(m_dc, m_rc.right - m_rc.left, m_rc.bottom - m_rc.top); 
			m_hOldBitmap = SelectObject(&m_bitmap); 
			::DPtoLP(m_dc->m_hDC, (LPPOINT)&m_rc, sizeof(RECT) / sizeof(POINT)); 
			SetWindowOrg(m_rc.left, m_rc.top); 
			FillSolidRect(&m_rc, m_dc->GetBkColor()); 
		} 
		~CMemDC() 
		{ 
			m_dc->BitBlt(m_rc.left, m_rc.top, m_rc.right - m_rc.left, m_rc.bottom - m_rc.top, 
				this, m_rc.left, m_rc.top, SRCCOPY); 
			SelectObject(m_hOldBitmap); 
			delete m_dc; 
		} 
	}; 
}; 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_BUTTONEX_H__53063543_3E40_4B91_A607_A78E280DDBA2__INCLUDED_)