You could use
DrawThemedBackground from the UxTheme
api. Here's a quick example:
Delphi-Quellcode:
uses UxTheme;
TMyForm = class(TForm)
private
Theme: hTheme;
end;
procedure TMyForm.FormCreate(Sender: TObject);
begin
Theme := OpenThemeData(0, 'ListView');
end;
procedure TMyForm.FormDestroy(Sender: TObject);
begin
CloseThemeData(Theme);
end;
procedure TMyForm.ListViewCustomDraw(...);
var
StateId: Integer;
begin
StateId := LIS_SELECTED; // LIS_SELECTEDNOTFOCUS // LIS_NORMAL
DrawThemeBackground(
Theme,
ListView.Canvas.Handle,
LVP_LISTITEM,
StateId,
Rect,
nil
);
{ Other drawing code... }
end;
But if you do this, be careful to check if Themes are available or else your program will not work on older systems.
[edit]
In order to see any difference, you have to execute the SetWindowTheme-code from above first (before you acquire the theme
handle). Or you could replace
'ListView'
with
'Explorer::ListView'
. But the former version is preferable.
[/edit]