home *** CD-ROM | disk | FTP | other *** search
- unit Textrot1;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs;
-
- type
- TForm1 = class(TForm)
- procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- private
- { Private-Deklarationen }
- 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);
- C.Font.Handle := CreateFontIndirect(LogRec);
- end;
-
- (*procedure CanvasTextOutAngle(C: TCanvas; x,y: Integer; A: Word; S: string);
- var
- LogRec: TLOGFONT;
- FHandleOld, FHandleNew: HFONT;
- begin
- GetObject(C.Font.Handle, SizeOf(LogRec), Addr(LogRec));
- LogRec.lfEscapement := d;
-
- {* Create a new font handle using the modified old font handle *}
- NewFontHandle := CreateFontIndirect(LogRec);
-
- {* Save the old font handle! We have to put it back when we are done! *}
- OldFontHandle := SelectObject(c.Handle,NewFontHandle);
-
- {* Finally. Output the text! *}
- c.TextOut(x,y,s);
-
- {* Put the font back the way we found it! *}
- NewFontHandle := SelectObject(c.Handle,OldFontHandle);
-
- {* Delete the temporary (NewFontHandle) that we created *}
- DeleteObject(NewFontHandle);
-
- end; {* CanvasTextOutAngle *}
- *)
- procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- Var A: Integer;
- begin
- A := Random(3600);
- CanvasSetAngle(Canvas, A / 10);
- Canvas.RectAngle(X-1,Y-1,X+1,Y+1);
- Canvas.TextOut(x, Y, FormatFloat('##0.0', A/10)+'░');
- end;
-
- end.
-