Einzelnen Beitrag anzeigen

Benutzerbild von Rued
Rued

Registriert seit: 14. Mai 2008
Ort: Schleching
83 Beiträge
 
Delphi 12 Athens
 
#3

AW: Wieder einmal Autoscroll im Memo-Feld

  Alt 25. Jan 2025, 16:21
Hast Du mal die ScrollTo Optionen angesehen und damit etwas versucht?
Ich nutze ScrollToTop, was bei meiner Anwendung funktioniert, aber solche Basics wie Scrolling sind immer wieder extrem fragil.

Delphi-Quellcode:
procedure TCustomPresentedScrollBox.ScrollToCenter(const AAnimated: Boolean);
var
  ContentBoundsTmp: TRectF;
  ViewportSizeTmp: TSizeF;
  DestPoint: TPointF;
begin
  ContentBoundsTmp := ContentBounds;
  ViewportSizeTmp := ViewportSize;
  DestPoint := TPointF.Create((ContentBoundsTmp.Width - ViewportSizeTmp.Width) / 2, (ContentBoundsTmp.Height - ViewportSizeTmp.Height) /2);
  ScrollBy(DestPoint.X - ViewportPosition.X, DestPoint.Y - ViewportPosition.Y, AAnimated);
end;

procedure TCustomPresentedScrollBox.ScrollToTop(const AAnimated: Boolean = True);
begin
  ScrollBy(0, -ViewportPosition.Y, AAnimated);
end;
Mit ScrollToTop komme ich super klar. Herzlichen Dank!
Rüdiger Droste
  Mit Zitat antworten Zitat