Hi,

is it possible to change the color of selected items ?
Without using LVS_OWNERDRAWFIXED Flag ?

Greeting,
Nordwind64
Posted on 2003-05-02 13:29:44 by Nordwind64
Posted on 2003-05-03 01:02:08 by smurf
Thanks !

Now i have coloured columns, but how can I color one or more selected lines ???

Greetings,
Nordwind64
Posted on 2003-05-04 07:06:58 by Nordwind64
this should get you started in the right direction. i dont have time right now to completely figure it out. some of the following values may not be in the windows.inc and you may need to add them yourself.

.elseif uMsg==WM_NOTIFY

mov edi,lParam
assume edi:ptr NMHDR
mov eax,[edi].hwndFrom
.if eax == hListView
.if [edi].code == NM_CUSTOMDRAW
assume edi:ptr NMCUSTOMDRAW
.if [edi].dwDrawStage == CDDS_PREPAINT
mov eax,CDRF_NOTIFYITEMDRAW
ret
.elseif [edi].dwDrawStage == CDDS_ITEMPREPAINT
mov eax,CDRF_NOTIFYSUBITEMDRAW
ret
.elseif [edi].dwDrawStage == CDDS_ITEMPREPAINT || CDDS_SUBITEM
assume edi:ptr NMLVCUSTOMDRAW
.if [edi].iSubItem == 0
RGB 230,158,160
mov [edi].clrTextBk,eax
.elseif [edi].iSubItem == 1
RGB 255,174,0
mov [edi].clrTextBk,eax
.elseif [edi].iSubItem == 2
RGB 50,200,160
mov [edi].clrTextBk,eax
.elseif [edi].iSubItem == 3
RGB 1,36,250
mov [edi].clrTextBk,eax
.endif
.endif
.endif
.endif
Posted on 2003-05-04 11:08:07 by smurf
Hi smurf.

Many thanks, but I can't get it work...
I can get work your code, but it seens not possible to color only one or some lines (selected lines).
:stupid:

Greetings,
Nordwind64
Posted on 2003-05-04 13:59:45 by Nordwind64
If you want to colour the whole line in a listview you can miss out the subitem stuff - this is the code I used recently on a project



.if uMsg==WM_NOTIFY

ASSUME edi:PTR NMHDR
mov edi,lParam
mov ebx,[edi].code
mov eax,hListView

.if [edi].hwndFrom==eax

.if ebx==NM_CUSTOMDRAW

ASSUME edi:PTR NMLVCUSTOMDRAW

.if [edi].nmcd.dwDrawStage == CDDS_PREPAINT

mov eax,CDRF_NOTIFYITEMDRAW
ret

.elseif [edi].nmcd.dwDrawStage ==CDDS_ITEMPREPAINT

mov ecx,[edi].nmcd.dwItemSpec

.if ecx==4

mov [edi].clrTextBk,00FFEE22h

.else

mov [edi].clrTextBk,0002C97Ah

.endif


mov eax,CDRF_NEWFONT
ret

.endif

.endif

.endif


dwItemSpec is the row the WM_NOTIFY is currently processing - here i use an example of colouring the 4th item in a diff colour to the rest.

The return values seem to be pretty important for the WM_NOTIFY event - if you return the wrong one then it will seem that nothing has happened.

Hope this helps

Mark
Posted on 2003-05-04 14:48:49 by MurkyT
Hi,

hey MurkyT, that's it:

mov eax,CDRF_NEWFONT
ret

Now it work's to color only one or few lines !!!

A big thank you,
Nrodwind64
Posted on 2003-05-05 09:44:13 by Nordwind64