16,466
社区成员
发帖
与我相关
我的任务
分享
CRect rct;
GetThumbRect(&rct);
if(rct.PtInRect(point))
{// 点击 滑块
CSliderCtrl::OnLButtonDown(nFlags, point);
return;
}
// 不在 滑块
CRect rcc;
GetChannelRect(&rcc);
double f=100.0/rcc.Width();
int ptx=(int)((point.x-rcc.left)*f);
// afxDump << point.x << ";" << ptx << "\n";// 20;0
SetPos(ptx);
void CYourSlider::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
// int pos=GetPos();
// int page=GetPageSize();
//
CRect rcc;
GetChannelRect(&rcc);
double f=100.0/rcc.Width();
int ptx=(int)((point.x-rcc.left)*f);
SetPos(ptx);