Hallo
Eine Google Suche hat folgende Funktion hervor gebracht:
Delphi-Quellcode:
procedure ListViewSetTopItem(ListView: TListView; ItemIndex: Integer);
var
Difference, ItemHeight: Integer;
begin
if not (ListView.ViewStyle = vsReport) then
Exit;
if (ItemIndex < 0) or (ListView.Items.Count = 0) or
(ItemIndex > ListView.Items.Count - 1) then
raise EInvalidOperation.CreateFmt(SPropertyOutOfRange, ['TopItem']);
with ListView do
begin
Difference := TopItem.Index - Items.Item[ItemIndex].Index;
with Items.Item[0].DisplayRect(drBounds) do
ItemHeight := Top - Bottom;
Scroll(0, Difference * ItemHeight);
end;
end;