unit Textrot1;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, ExtCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
    index:Integer;
    cl:Boolean;
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure CanvasSetAngle(C: TCanvas; A: Single);
var
  LogRec: TLOGFONT;     {Font informationen}
begin
 GetObject(C.Font.Handle,SizeOf(LogRec),Addr(LogRec));
 LogRec.lfEscapement := Trunc(A*10);
 LogRec.lfOrientation := Trunc((A+10) * 100);
 C.Font.Handle := CreateFontIndirect(LogRec);
end;

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
Var A: Integer;
begin
   A := Random(3600);
   CanvasSetAngle(Canvas, A / 10);
   Canvas.TextOut(x, Y, FormatFloat('##0.0', A/10)+'°');
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
 CanvasSetAngle(Canvas, index);
 Canvas.TextOut(100, 100, 'CyD Soft');
 index:=index+45;
 if index>=360 then
  begin
   index:=0;
   if cl then
    Canvas.Font.Color:=clBlack
   else
    Canvas.Font.Color:=clRed;
   cl:=not cl;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 index:=0;
end;

end.
