TrackControl.h
资源名称:Excel.rar [点击查看]
上传用户:aymxxn
上传日期:2014-11-29
资源大小:135k
文件大小:2k
源码类别:
文件操作
开发平台:
Visual C++
- #if !defined(AFX_TRACKCONTROL_H__06A38C29_E713_4289_97B5_EC17CA3DAED0__INCLUDED_)
- #define AFX_TRACKCONTROL_H__06A38C29_E713_4289_97B5_EC17CA3DAED0__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- // TrackControl.h : header file
- // Modified by jingzhou xu
- template<class BaseClass>
- /////////////////////////////////////////////////////////////////////////////
- // CTrackControl window
- class CTrackControl : public BaseClass
- {
- // Construction
- public:
- CTrackControl()
- {
- m_bTracking=m_bHover=FALSE;
- }
- virtual ~CTrackControl() {}
- BOOLEAN IsHover()
- {
- return m_bHover;
- }
- // Implementation
- public:
- virtual void OnHoverEnter()=0;
- virtual void OnHoverLeave()=0;
- // Generated message map functions
- protected:
- virtual LRESULT WindowProc(UINT nMessage, WPARAM wParam, LPARAM lParam)
- {
- LRESULT nResult=BaseClass::WindowProc(nMessage,wParam,lParam);
- switch(nMessage)
- {
- case WM_MOUSEMOVE:
- {
- if (!m_bTracking)
- {
- TRACKMOUSEEVENT Tme;
- Tme.cbSize = sizeof(Tme);
- Tme.hwndTrack = GetSafeHwnd();
- Tme.dwFlags = TME_LEAVE|TME_HOVER;
- Tme.dwHoverTime = 1;
- if (_TrackMouseEvent(&Tme))
- m_bTracking=TRUE;
- }
- break;
- }
- case WM_MOUSEHOVER:
- m_bHover=TRUE;
- OnHoverEnter();
- break;
- case WM_MOUSELEAVE:
- m_bTracking=m_bHover=FALSE;
- OnHoverLeave();
- break;
- }
- return nResult;
- }
- private:
- BOOLEAN m_bTracking;
- BOOLEAN m_bHover;
- };
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_TRACKCONTROL_H__06A38C29_E713_4289_97B5_EC17CA3DAED0__INCLUDED_)