我正在绘制自定义滑块控件。但是我的抽动痕迹在移动拇指时会被抹去。我在ITEMPREPAINT中绘制如下标题:
if( lpcd->dwDrawStage == CDDS_ITEMPREPAINT )
{
if(lpcd->dwItemSpec == TBCD_TICS)
{
CDC *pDC = CDC::FromHandle(lpcd->hdc);
INT nMin=0,nMax=0,range;
GetRange(nMin,nMax);
range = nMax - nMin;
INT num_tics = 4;
INT frequency = range/num_tics;
CRect channelRect, thumbRect;
GetChannelRect(&channelRect);
GetThumbRect(&thumbRect);
INT width,pos=channelRect.left;
/*pDC->MoveTo(pos,channelRect.bottom);
pDC->LineTo(pos,channelRect.bottom+10);*/
for (INT tic=0; tic<num_tics; tic++)
{
width = channelRect.right - channelRect.left;
pos += width/num_tics;
pDC->MoveTo(pos,channelRect.bottom);
pDC->LineTo(pos,channelRect.bottom+10);
}
*pResult = CDRF_SKIPDEFAULT;
return;
}
}