Ich hatte noch zwei If-Abfragen und noch einen etwas anderen Code:
Delphi-Quellcode:
if ScrollCode = scLineDown then
begin
ZeroMemory(@WinInfo, sizeOf(WinInfo));
WinInfo.cbSize := SizeOf(WinInfo);
GetWindowInfo(lbList.Handle, WinInfo);
iHeight := WinInfo.rcClient.Bottom - WinInfo.rcClient.Top;
xiScrollV.Max := (lbList.Count * lbList.ItemHeight - iHeight) div lbList.ItemHeight + 1;
Rect := lbList.ItemRect(0);
xiScrollV.Position := (Rect.Top div lbList.ItemHeight* -1)
end else
if if ScrollCode = scLineUp then
begin
ZeroMemory(@WinInfo, sizeOf(WinInfo));
WinInfo.cbSize := SizeOf(WinInfo);
GetWindowInfo(lbList.Handle, WinInfo);
iHeight:= WinInfo.rcClient.Top - WinInfo.rcClient.Bottom;
xiScrollV.Max := (lbList.Count * lbList.ItemHeight - iHeight) div lbList.ItemHeight + 1;
Rect := lbList.ItemRect(0) ;
xiScrollV.Position := (Rect.Bottom div lbList.ItemHeight * -1);
end;
Danke, jetzt funktioniert alles!