Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu
Online

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.722 Beiträge
 
Delphi 12 Athens
 
#5

AW: FMX.Graphics.TCanvas.FillText drehen

  Alt 3. Sep 2025, 22:21
Delphi-Quellcode:
procedure TForm3.FormPaint(Sender: TObject; Canvas: TCanvas; const ARect: TRectF);
var
  Angle: Single;
  Matrix: TMatrix;
begin
  Canvas.Fill.Color := TAlphaColors.Black;
  Angle := -ArcTan2(ClientHeight, ClientWidth);
  Matrix := Canvas.Matrix.CreateRotation(Angle);
  Canvas.SetMatrix(Matrix);
  Canvas.FillText(ClientRect, 'Rotated FMX Text', False, 1, [], TTextAlign.Leading, TTextAlign.Trailing);
Hatte hier als Winkel zuerst 0.3 probiert, aber war nix zu sehn.
Delphi-Quellcode:
  Canvas.Fill.Color := TAlphaColors.Black;
  Canvas.SetMatrix(Canvas.Matrix.CreateRotation(-0.64));
  Canvas.FillText(ClientRect, 'Rotated FMX Text', False, 1, [], TTextAlign.Leading, TTextAlign.Trailing);
Ja, das Erste berechnet auch einen negativen Winkel und der liegt innerhalb des Canvas-Rechtecks.

Wie bei drawRotatedText muß man also noch das X:Y dazurechnen,
bzw. das RectF für FillText ordentlich befüllen.
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat