15,979
社区成员
发帖
与我相关
我的任务
分享
CPoint ptCursor;
GetCursorPos(&ptCursor);
CRect rcSlider;
int nMin, nMax;
m_Slider.GetRange(nMin, nMax);
m_Slider.ScreenToClient(&ptCursor);
m_Slider.GetClientRect(&rcSlider);
int nCurPos = nMin + ptCursor.x * (nMax - nMin) /rcSlider.Width();
if(nCurPos > nMax)
nCurPos = nMax;
else if(nCurPos < nMin)
nCurPos = nMin;
m_Slider.SetPos(nCurPos);
afx_msg void OnMouseMove(
UINT nFlags,
CPoint point
);
{
if(nFlags == MK_LBUTTON)//鼠标左键按下
{
// do what u want
}
}