|
-
January 10th, 2009, 09:09 PM
#1
Custom drawn ListView- can't receive CDRF_NOTIFYITEMDRAW
I'm custom-drawing a listview control, but while I can receive the CDDS_PREPAINT message, the CDDS_ITEMPREPAINT never comes. I've searched around and tried various things, but to no avail.
Here is the WM_NOTIFY message:
Code:
DWORD result; //global variable
...
case WM_NOTIFY:
if(((LPNMHDR)lp)->code==NM_CUSTOMDRAW && ((LPNMHDR)lp)->idFrom == 5467)
{
LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lp;
switch(lplvcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT: //this message is processed fine
result = CDRF_NOTIFYITEMDRAW;
break;
case CDDS_ITEMPREPAINT: //I never receive this one
{
int iRow = lplvcd->nmcd.dwItemSpec;
if(iRow & 1)
{
lplvcd->clrTextBk = RGB(255, 34, 100);
lplvcd->clrText = RGB(255, 22, 2);
result = CDRF_NEWFONT;
}
result = CDRF_DODEFAULT;
}
break;
default:
result = CDRF_DODEFAULT;
}
return result;
}
What could be the reason for this? Thanks for any help.
Last edited by lunaroverlord; January 10th, 2009 at 09:12 PM.
-
January 11th, 2009, 07:07 AM
#2
Re: Custom drawn ListView- can't receive CDRF_NOTIFYITEMDRAW
It's a Win32 FAQ (famous since 1995...)
(see news://comp.os.ms-windows.programmer.win32)
-
January 11th, 2009, 07:45 AM
#3
Re: Custom drawn ListView- can't receive CDRF_NOTIFYITEMDRAW
Did you try CDRF_NOTIFYSUBITEMDRAW?
-
January 11th, 2009, 03:18 PM
#4
Re: Custom drawn ListView- can't receive CDRF_NOTIFYITEMDRAW
Thanks for the responses, but it still doesn't work.
I tried with CDRF_NOTIFYSUBITEMDRAW, nothing. The only value that ever comes to lplvcd->nmcd.dwDrawStage is 1 (CDDS_PREPAINT), checked that in debugger. Strange, is the code not correct? Why wouldn't it notify me with the CDDS_ITEMPREPAINT message when I'm returning CDRF_NOTIFYITEMDRAW?
EDIT:
Maybe the problem's somehow related to that my ListView is not in a dialog, but in the main window?
This was the original example I borrowed my code from:
Code:
if(((LPNMHDR)lParam)->code == NM_CUSTOMDRAW)
{
SetWindowLong(hWnd, DWL_MSGRESULT,
(LONG)ProcessCustomDraw(lParam));
return TRUE;
}
Here it's used in dialog, but my ListView is a child of the main window, so I'm just returning the value to WndProc. (ProcessCustomDraw is the processing code)
Last edited by lunaroverlord; January 12th, 2009 at 08:25 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|