BEGIN_MESSAGE_MAP(CProSliderCtrl, CSliderCtrl)
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnNMCustomdraw)
...
END_MESSAGE_MAP()
...
void CProSliderCtrl::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR);
switch(pNMCD->dwDrawStage)
{
case CDDS_POSTERASE: // After the erasing cycle is complete.
*pResult = CDRF_SKIPDEFAULT;
break;
case CDDS_POSTPAINT: // After the painting cycle is complete.
*pResult = CDRF_DODEFAULT;
break;
case CDDS_PREERASE: // Before the erasing cycle begins.
*pResult = CDRF_SKIPDEFAULT;
break;
case CDDS_PREPAINT: // Before the painting cycle begins.
*pResult = CDRF_NOTIFYITEMDRAW;
break;
case CDDS_ITEMPREPAINT: // Before an item is drawn.
switch(pNMCD->dwItemSpec)
{
// Identifies the channel that the slider control's thumb marker slides along.
case TBCD_CHANNEL:
if(m_bBorders)DrawSliderBorder(pNMCD);
DrawSliderChannel(pNMCD);
*pResult = CDRF_SKIPDEFAULT;
break;
// Identifies the increment tick marks that appear along the edge of the slider control.
case TBCD_TICS:
*pResult = CDRF_DODEFAULT;
break;
// Identifies the slider control's thumb marker. This is the portion of
// the control that the user moves.
case TBCD_THUMB:
if(DrawSliderThumb(pNMCD)==S_OK)
*pResult = CDRF_SKIPDEFAULT;
else
*pResult = CDRF_DODEFAULT;
break;
default:
*pResult = CDRF_DODEFAULT;
break;
}
break;
default:
*pResult = CDRF_DODEFAULT;
break;
}
}