delphilistviewselectionsyslistview32

SysListView32 like mouse selection rectangle


Can I make a mouse selection rectangle in a List View like in a SysListView32? enter image description here

Is there a way to work with a SysListView32 and use it in Delphi?

Thanks!


Solution

  • You need to set LVS_EX_DOUBLEBUFFER style of the list view (only applicable with comctl32.dll version 6.0 (XP) and later):

    [...] This extended style also enables alpha-blended marquee selection on systems where it is supported.


    uses
      commctrl;
    ..
    
    ListView_SetExtendedListViewStyle(ListView1.Handle, LVS_EX_DOUBLEBUFFER);
    


    It also works with the TShellListView component included as a demo. See this answer to find out how to find and install the shell controls.

    (PS: Don't forget to set Multiselect to true)