www.pudn.com > 酒店管理系统源代码.rar > CoolTipCtrl.h


/*######################################################################## 
	Filename: 	cooltipctrl.h 
	---------------------------------------------------- 
	Remarks:	... 
	---------------------------------------------------- 
 
  ########################################################################*/ 
 
#if !defined(_ANYOU_COOLTIP_H) 
#define _ANYOU_COOLTIP_H 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#define WS_EX_LAYERED		0x00080000 
#define LWA_ALPHA			0x00000002 
 
//CoolTip Ctrl Styles:------------------------ 
#define TIPS_AUTOSIZE		0x00000001 
#define TIPS_TRANSPARENT	0x00000002 
#define TIPS_SHOWNEXT		0x00000008 
 
#define TIPS_FADEIN			0x00000010 
#define TIPS_FADEOUT		0x00000020 
#define TIPS_NORMAL			0x00000040 
#define TIPS_DELAYSHOW		0x00000080 
#define TIPS_HIDE			0x00000100 
#define TIPS_VISIBLE		0x00000070 
#define TIPS_SHOWING		0x000000F0 
 
/*#################################################################### 
			------------------------------------------------ 
						   CCoolTipCtrl class 
			------------------------------------------------ 
  ####################################################################*/ 
class CCoolTipCtrl : public CWnd 
{ 
// Construction----------------------------------- 
public: 
	CCoolTipCtrl(); 
	virtual ~CCoolTipCtrl(); 
	BOOL Create(CSize size, CWnd* pParentWnd, UINT dwStyle = 1, UINT uID = 0); 
 
// Overrides--------------------------------------- 
public: 
	//{{AFX_VIRTUAL(CCoolTipCtrl) 
	public: 
	protected: 
	//}}AFX_VIRTUAL 
 
// Implementation---------------------------------- 
public: 
	BOOL Hide(); 
	BOOL Show(CPoint point); 
 
//Attributes--------------------------------------- 
public: 
	DWORD GetState() {return m_dwState;} 
	DWORD GetStyle() {return m_dwStyle;} 
	CRect GetRect() {return m_rcRect;} 
	CString GetText() {return m_strText;} 
	CString GetTitleText() {return m_strTitle;} 
	COLORREF GetTextColor() {return m_crText;} 
	COLORREF GetTitleColor() {return m_crTitle;} 
	BOOL	IsShow(); 
 
//Operations--------------------------------------- 
public: 
	UINT OnNcHitTest(CPoint point); 
	void DrawShadow(CDC *pDC, CRect rect, COLORREF color = RGB(0,0,0)); 
	void SetText(CString strText); 
	void SetTitle(CString strTitle); 
	void SetRect(const CRect& rect); 
	void SetDelayTime(int nTime); 
	void SetBkColor(COLORREF crBk); 
	void SetTextColor(COLORREF crText); 
	void SetTitleColor(COLORREF crTitle); 
	void SetSize(CSize sz); 
	void SetIcon(HICON hIcon, CSize szIcon = CSize(16,16)); 
 
//Protected Methods-------------------------------- 
protected: 
	void AutoSize(); 
	void OnDraw(CDC *pDC); 
	BOOL SetTransparent(HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags); 
	CSize GetStringSize(CString strText, int nlinecount, CSize szFont); 
 
//Member Variables:-------------------------------- 
private: 
	DWORD	m_dwStyle;		//Tip control style 
	DWORD	m_dwState; 
 
	COLORREF m_crTitle;		//Title text color 
	COLORREF m_crText;		//Text color 
	COLORREF m_crBk;		//Background color 
	HICON	 m_hIcon; 
 
	CSize m_nSize;			//Window size 
	CSize m_szText;			//text size 
	CSize m_szIcon;			//Icon size 
 
	int m_nFade;			//Fade time 
	int m_nDelayTime;		//Delay time 
	int m_nShowTime;		//Show time 
 
	CString m_strText;		//Tip Text 
	CString m_strTitle;		//Title 
 
	CRect m_rcRect;			//rect 
	CPoint m_point;			//mouse point 
 
	HMODULE	hUserDll ;		//DLL 
 
	CDC m_MemDC;			//Memory dc 
	CBitmap bitmap; 
	CBitmap *oldbitmap;		//old map 
 
// Generated message map functions------------------ 
protected: 
	//{{AFX_MSG(CCoolTipCtrl) 
	afx_msg void OnTimer(UINT nIDEvent); 
	afx_msg void OnPaint(); 
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point); 
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); 
	afx_msg void OnDestroy(); 
	afx_msg void OnNcPaint(); 
	afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp); 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
//{{AFX_INSERT_LOCATION}} 
#endif // !defined(_ANYOU_COOLTIP_H)