i can't seems to get an item to have a color..
iv tried o look at win32asm's source..all seems to have it working and i try convert, but it doesn't seems to work!



case WM_NOTIFY:
{
switch(LOWORD(wParam))
{
case IDC_LIST:
{
if(((LPNMHDR)lParam)->code == NM_CUSTOMDRAW)
{
NMLVCUSTOMDRAW *cdraw = (NMLVCUSTOMDRAW*)lParam;

if (cdraw->nmcd.dwDrawStage == CDDS_PREPAINT)
return CDRF_NOTIFYITEMDRAW;

if (cdraw->nmcd.dwDrawStage == CDDS_ITEMPREPAINT || cdraw->nmcd.dwDrawStage == CDDS_SUBITEM)
{
COLORREF crText;

if ( cdraw->iSubItem==2 )
crText = RGB(255,0,0);
else if ( cdraw->iSubItem==1 )
crText = RGB(0,255,0);
else
crText = RGB(128,128,255);

cdraw->clrText = crText;

return CDRF_DODEFAULT;
}

}
}
}
}


the message never arrives at if (cdraw->nmcd.dwDrawStage == CDDS_ITEMPREPAINT || cdraw->nmcd.dwDrawStage == CDDS_SUBITEM)

do i need to set my listView to have some style or something?
Posted on 2003-03-18 04:51:35 by wizzra
hi wizzra,

I am not quite sure, but:

- if your listview control is in a dialog box, your code should be changed to:


if (cdraw->nmcd.dwDrawStage == CDDS_PREPAINT) {
SetWindowLing(hDlg, DWL_MSGRESULT, CDRF_NOTIFYITEMDRAW);
return TRUE;


And CDDS_SUBITEM is possibly just a flag added to the other values.

No special listview style is required.

Japheth
Posted on 2003-03-20 00:50:02 by japheth
heya!
thnx for ur reply.
i also found a nice sulotion deeply inside msdn.
i uploaded the sulotion at my post article:
http://codeproject.com/useritems/ListView.asp
Posted on 2003-03-20 12:46:29 by wizzra