MFC自定义刻度线在滑块移动时被删除

时间:2015-01-16 12:22:09

标签: mfc

我正在绘制自定义滑块控件。但是我的抽动痕迹在移动拇指时会被抹去。我在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;
         }
}

0 个答案:

没有答案