1

When mouse moves above TListView items, there's that blue outline (see picture). How would I remove it?

The only way I know is to do all the item drawing manually... But maybe there's an easier way? Tried HotTrack=False, doesn't help :(

Item3 has this blue outline

djsoft
  • 1,051
  • 8
  • 19
  • Why do you want to go against the platform's standard way of doing things? That blue rectangle is a very important hint to the user. It tells him what would be selected if he clicked there and then. – Marjan Venema Mar 01 '13 at 09:11
  • I use custom background color for items, and while moving mouse over the items, this background disappears. – djsoft Mar 01 '13 at 10:50
  • Ah ok, good on you, you are keeping the function of it just implement it differently. – Marjan Venema Mar 01 '13 at 10:53

1 Answers1

3

That painting is done by the special explorer theme. That is added to the control by a call to SetWindowTheme(Handle, 'explorer', nil) in TCustomListView.CreateWnd. If you use the default theme then you will not get the hot tracking. You can make that happen by reverting the explorer window theme. For example in an interposer class:

type
  TListView = class(ComCtrls.TListView)
  protected
    procedure CreateWnd; override;
  end;
....    
procedure TListView.CreateWnd;
begin
  inherited;
  SetWindowTheme(Handle, nil, nil);
end;

Of course, you'll also lose everything else that the explorer theme adds.

So far as I can tell, there are no notification messages that allow you to suppress the explorer theme hot tracking painting.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • 1
    Hmm... changing a whole control theme is a bit overkill :) I suppose I need to implement full item drawing myself then. – djsoft Mar 01 '13 at 10:54
  • 1
    It looks like I don't have to reinvent the wheel, this SO question has the code to draw items: http://stackoverflow.com/questions/5519742/drawing-a-checkbox-in-a-tlistview In case anyone else will be looking for this :) – djsoft Mar 01 '13 at 11:41