News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Listview fullrowselect left border issue

Started by fearless, February 10, 2016, 05:47:01 AM

Previous topic - Next topic

fearless

A small issue that has bothered me with listview and using full row select, there always seems to be a small area of white padding before the selection on each row. Just wondering if anyone has figured out how to stretch the selection bar fully across to cover this area? I presume this is the default behaviour, but maybe someone has come across some code that uses NMCUSTOMDRAW to adjust the bounding rect somehow?


Attached is the example project that illustrates this issue.








jj2007

Quote from: fearless on February 10, 2016, 05:47:01 AM
I presume this is the default behaviour

Indeed. And it ends exactly with the icon, if there is one.

Have you tried subclassing the background erase message?

fearless

Managed to play around with the custom draw enough to get it working, plus a custom color selection bar - needed to get the hdc of the listview and use LVM_GETITEMRECT with  LVIR_BOUNDS, then adjust the bounding rectangle to just the right size required to fill with FillRect. Small padding area appears to be a width of 4. Also bottom of returned rect needs to be decreased by 1 to prevent a small overspill into next item row. I tried adjusting rect.left more, but thats the best i can get in terms of full width selection and row items.

Ive uploaded a new version of the test project and commented it a bit to help explain whats happening.