1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
// SliderEx.cpp : implementation file
//
#include "stdafx.h"
#include "spinsample.h"
#include "SliderEx.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSliderEx
CSliderEx::CSliderEx():m_bTracking(false)
{
}
CSliderEx::~CSliderEx()
{
}
BEGIN_MESSAGE_MAP(CSliderEx, CSliderCtrl)
//{{AFX_MSG_MAP(CSliderEx)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSliderEx message handlers
void CSliderEx::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_bTracking=true;
CSliderCtrl::OnLButtonDown(nFlags, point);
}
void CSliderEx::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_bTracking=false;
CSliderCtrl::OnLButtonUp(nFlags, point);
}
void CSliderEx::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if(m_bTracking)
{
NMHDR hdr;
hdr.hwndFrom = GetSafeHwnd();
hdr.idFrom = GetDlgCtrlID();
hdr.code = SLIDER_GETPOS;
GetParent()->SendMessage(WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&hdr);
}
CSliderCtrl::OnMouseMove(nFlags, point);
} |
Partager