Einzelnen Beitrag anzeigen

Nils_13

Registriert seit: 15. Nov 2004
2.647 Beiträge
 
#16

Re: [TListBox] Aktuelle Scrollzeile

  Alt 15. Feb 2007, 20:12

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!
  Mit Zitat antworten Zitat