// MySliderCtrl.cpp : implementation file // #include "stdafx.h" #include "MovePlayer.h" #include "MySliderCtrl.h" #include "math.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMySliderCtrl CMySliderCtrl::CMySliderCtrl() { } CMySliderCtrl::~CMySliderCtrl() { } BEGIN_MESSAGE_MAP(CMySliderCtrl, CSliderCtrl) //{{AFX_MSG_MAP(CMySliderCtrl) ON_WM_LBUTTONDOWN() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMySliderCtrl message handlers void CMySliderCtrl::OnLButtonDown(UINT nFlags, CPoint point) { DWORD currentpos = GetPos(); CRect rc; GetClientRect(&rc); int max,min; GetRange(min, max); DWORD clickpos = min + (point.x-9) * (max-min) / (rc.right-9*2); SetPageSize(abs(clickpos - currentpos)); CSliderCtrl::OnLButtonDown(nFlags, point); }