I have a list view and draw it with OwnerDraw.
How to draw a simple and smooth progress bar with rounded angles and a line on the top a
Font will be incorrect for additional sub-items.
Sender.Canvas.Font.OnChange(Sender);
Thanks to Delphi TListview OwnerDraw SubItems - change default font (it's bold somehow after you Draw on the canvas)
e.g.:
procedure TForm1.ListView1CustomDrawSubItem(Sender: TCustomListView;
Item: TListItem; SubItem: Integer; State: TCustomDrawState;
var DefaultDraw: Boolean);
var
ListView: TListView absolute Sender;
R: TRect;
begin
DefaultDraw := SubItem <> StatusColumnIndex;
if not DefaultDraw then
begin
ListView_GetSubItemRect(ListView.Handle, Item.Index, SubItem,
LVIR_BOUNDS, @R);
DrawStatus(ListView.Canvas.Handle, R, State, ListView.Font, 'Downloading',
Random(101) / 100);
end;
Sender.Canvas.Font.OnChange(Sender);
end;