One thing I immediately spotted:
Delphi-Quellcode:
procedure TForm20.FormCreate(Sender: TObject);
begin
SetWindowTheme(lvRecentFiles.Handle, 'Explorer', nil);
Theme := OpenThemeData(0, 'ListView');
end;
has to be
Delphi-Quellcode:
procedure TForm20.FormCreate(Sender: TObject);
begin
SetWindowTheme(lvRecentFiles.Handle, 'Explorer', nil);
Theme := OpenThemeData(lvRecentFiles.Handle, 'ListView');
end;
Because, as I said, you have to manually activate the "explorer style" for each window by calling SetWindowTheme. If you do this for a specific window, but then open the theme data of a
different window
handle (0), of course it won't work.
Not saying, that this is the only issue (might be, might not be), but at least it's one reason why it can't work. If it doesn't work after changing this, try to set
DefaultDraw
to
False
because it's possible that the default drawing routine overdraws the background again (I don't know about that and I'm too lazy to look it up in the
VCL sources).
Also, I don't know what the difference between
OnDrawItem
and
OnCustomDrawItem
is, and in which order they are called. But I would suggest moving the
DrawThemedBackground
-code to the
OnDrawItem
routine.