Einzelnen Beitrag anzeigen

Rollo62

Registriert seit: 15. Mär 2007
4.148 Beiträge
 
Delphi 12 Athens
 
#2

AW: Wieder einmal Autoscroll im Memo-Feld

  Alt 21. Jan 2025, 09:53
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 Zitat antworten Zitat