CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Nov 2008
    Posts
    3

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured