maxfax
maxfax

Reputation: 4305

Delphi: unnecessary column lines & no RowSelect in List View (SysListView32)

There is a list view with a style (thanks to Sertac Akyuz for a solution:) )

ListView_SetExtendedListViewStyle(ListView1.Handle, LVS_EX_DOUBLEBUFFER);

But now a list view has two lacks: unnecessary column blue lines and rows are cannot be selected even if RowSelect:=True;. Rows are selected if to select Items, it doesn't work for Sub Items.

If to do GridLines:=True then a grid won't appear, something happens to a list view's background...

enter image description here

If to draw items with OwnerDraw then lines don't appear but only under items. I can paint a whole background, but is it the easiest way to hide those blue lines?

Can I handle these?

Thanks for your valuable answers!

Upvotes: 1

Views: 1563

Answers (1)

ain
ain

Reputation: 22749

When you call

ListView_SetExtendedListViewStyle(ListView1.Handle, LVS_EX_DOUBLEBUFFER);

you unset all other extended style flags, seting only LVS_EX_DOUBLEBUFFER on. So use

ListView_SetExtendedListViewStyle(ListView1.Handle,
    ListView_GetExtendedListViewStyle(ListView1.Handle) or LVS_EX_DOUBLEBUFFER);

to preserve existing flags.


The vertical lines are probably a product of the VCL's effort to imitate a system listview as much as possible. When themes are enabled, VCL calls SetWindowTheme on the listview passing 'explorer' as 'SubAppName' parameter, so the vertical lines you can see in an explorer folder view is duplicated. To undo that, you can call the function again yourself:

  SetWindowTheme(ListView1.Handle, nil, nil);

Note that you might not like what the listview becomes :).

Upvotes: 4

Related Questions