I want to have a custom progress bar control, for example showing some moving oblique lines or like this or drawing an image inside the progress bar control. I 've searched the web and some examples of custom drawing for listviews and dynamic subclassing but the code doesn't call the painting methods:
public:
BOOL SubclassWindow(HWND hWnd)
{
ATLASSERT(m_hWnd==NULL);
ATLASSERT(::IsWindow(hWnd));
BOOL bRet = CWindowImpl<CMyProgressControl, CProgressBarCtrl>::SubclassWindow(hWnd);
return bRet;
}
BEGIN_MSG_MAP(CMyProgressControl)
CHAIN_MSG_MAP(CCustomDraw<CMyProgressControl>)
END_MSG_MAP()
DWORD OnPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW /*lpNMCustomDraw*/)
{
return CDRF_NOTIFYITEMDRAW;
}
DWORD OnItemPrePaint(int /*idCtrl*/, LPNMCUSTOMDRAW lpNMCustomDraw)
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( lpNMCustomDraw );
// This is the prepaint stage for an item. Here's where we set the
// item's text color. Our return value will tell Windows to draw the
// item itself, but it will use the new color we set here for the background
COLORREF crText;
crText = RGB(200,200,255);
// Store the color back in the NMLVCUSTOMDRAW struct.
pLVCD->clrTextBk = crText;
// Tell Windows to paint the control itself.
return CDRF_DODEFAULT;
}