The MASM Forum

General => The Campus => Topic started by: fearless on February 10, 2016, 05:47:01 AM

Title: Listview fullrowselect left border issue
Post by: fearless on February 10, 2016, 05:47:01 AM
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.



(http://s30.postimg.org/92g21w9s1/listviewfullrowselectleftborder.png)



Title: Re: Listview fullrowselect left border issue
Post by: jj2007 on February 10, 2016, 01:41:06 PM
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?
Title: Re: Listview fullrowselect left border issue
Post by: fearless on February 11, 2016, 07:59:45 AM
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.

(http://s9.postimg.org/nxaavjxrj/listviewfullrowselectleftborderfilled.png)