I want to redraw a custom-drawn trackbar.
I've tried InvalidateRect, UpdateWindow, and RedrawWindow.
The only thing that works is EnableWindow FALSE, EnableWindow TRUE.
What can I change to make InvalidateRect to work?
Thanks
Code:
// window flags
tmbColor=gray; chColor=gray;
slider = CreateWindow(TRACKBAR_CLASS, NULL, WS_CHILD | WS_VISIBLE | TBS_VERT | TBS_NOTICKS, x1,y1,x2,y2, hWnd, (HMENU)ID_SLIDE, hInst, NULL);
// I want to redraw it with new colors
tmbColor=blue; chColor=blue;
InvalidateRect(slider, NULL, FALSE);
// NM_CUSTOMDRAW
case CDDS_PREPAINT:
return CDRF_NOTIFYITEMDRAW | CDRF_NOTIFYPOSTPAINT;
case CDDS_PREERASE:
case CDDS_POSTERASE:
case CDDS_ITEMPREERASE:
case CDDS_ITEMPOSTERASE:
return CDRF_DODEFAULT;
case CDDS_ITEMPREPAINT:
switch(itemSpec)
{
case TBCD_CHANNEL:
return CDRF_DODEFAULT | CDRF_NOTIFYPOSTPAINT;
case TBCD_THUMB:
/* code to draw thumb with tmbColor */
return CDRF_SKIPDEFAULT;
}
break;
case CDDS_ITEMPOSTPAINT:
switch(itemSpec)
{
case TBCD_CHANNEL:
/* code to draw channel with chColor */
return CDRF_SKIPDEFAULT;
case TBCD_THUMB:
return CDRF_SKIPDEFAULT;
}
break;
case CDDS_POSTPAINT:
return CDRF_DODEFAULT;
}