Hello again
I have a question to a colored listview item i use Wm_Notify) ,
Drawing a selected Item works fine.
Now wish i if mouseover a item to change the mouseover item to a other color than selected color
is the posible?
mov edi,lParam
.if [edi].NMHDR.code == LVN_HOTTRACK
mov eax,lParam
mov eax,[eax].NMLISTVIEW.iItem ;itemid
.elseif [edi].NMHDR.code==NM_CUSTOMDRAW
assume edi: ptr NMLVCUSTOMDRAW
.if [edi].nmcd.dwDrawStage == CDDS_PREPAINT ;Before the control paints itself
;If you are using the listview in a modal dialog box the return message
invoke SetWindowLong,hWnd,DWL_MSGRESULT,CDRF_NOTIFYITEMDRAW
ret
.elseif [edi].nmcd.dwDrawStage ==CDDS_ITEMPREPAINT ;|| CDDS_SUBITEM ;CDDS_ITEMPREPAINT - Before an item is drawn (this one also) CDDS_SUBITEM - Subitem is being drawn
.if ![edi].nmcd.uItemState & CDIS_SELECTED
;[edi].nmcd.uItemState & CDIS_HOT &&
mov esi,[edi].nmcd.dwItemSpec
mov [rect.left],LVIR_BOUNDS ; Get the bounding rect of the item
mov ebx,[edi].nmcd.hdc ; Get the device context
invoke SendMessage,hListViewPage,LVM_GETITEMRECT,esi,addr rect
invoke CreatePen,PS_SOLID, 1, 0C5C5C5h
invoke SelectObject,ebx,eax
invoke CreateSolidBrush,676767h
invoke FillRect,ebx,addr rect,eax
;-- Get item rect and itemtext
mov [rect.left],LVIR_LABEL
invoke SendMessage,hListViewPage,LVM_GETITEMRECT,esi,addr rect
mov lvi.iItem,esi
mov lvi.iSubItem,0
lea eax, local_buffer
mov lvi.pszText,eax
mov lvi.cchTextMax,256
invoke SendMessage,hListViewPage,LVM_GETITEMTEXT,esi,addr lvi
invoke DrawText,[edi].nmcd.hdc ,addr local_buffer,-1,addr rect,DT_LEFT + DT_VCENTER + DT_SINGLELINE
invoke SetWindowLong,hWnd,DWL_MSGRESULT,CDRF_SKIPDEFAULT
ret
.endif
.else
invoke SetWindowLong,hWnd,DWL_MSGRESULT,CDRF_DODEFAULT ;
ret
.endif
assume edi: nothing
LVN_HOTTRACK "Sent by a list-view control when the user moves the mouse over an item. "
Any an idea?
Regards,
I remember working with listview controls awhile ago and I found this page helpful: https://www.codeproject.com/articles/2890/using-listview-control-under-win-api. I don't know if this will be helpful to you or not .........
Thank you
A other problem is in WM_DRAWITEM (ownerfixed) can i use WM_MEASUREITEM message to set the item height.
gives a way without WM_DRAWITEM (ownerfixed) , only with Wm_Notify?
Greets,