unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 =
class(TForm)
PaintBox1: TPaintBox;
btn1: TButton;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
procedure TextOutAngle(
const Canvas: TCanvas; X, Y: Integer;
const AText:
string; AAngle: Integer);
procedure ClearPaintBox(Sender:TObject);
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure Tform1.TextOutAngle(
const Canvas: TCanvas; X, Y: Integer;
const AText:
string; AAngle: Integer);
var
hCurFont: HFONT;
LogFont: TLogFont;
begin
with Canvas
do
begin
hCurFont := Font.Handle;
try
GetObject(Font.Handle, SizeOf(LogFont), @LogFont);
LogFont.lfEscapement := AAngle;
LogFont.lfOrientation := AAngle;
Font.Handle:= CreateFontIndirect(LogFont);
try
TextOut(X, Y, AText);
finally
DeleteObject(Font.Handle);
end;
finally
Font.Handle := hCurFont;
end;
end;
end;
procedure TForm1.ClearPaintBox(Sender:TObject);
var
t:TRect;
begin
with PaintBox1.Canvas
do begin
Brush.Color:=Form1.Color;
FillRect(ClientRect);
end;
end;
procedure TForm1.btn1Click(Sender: TObject);
var
i: Integer;
begin
i:=100;
while i < 900
do
begin
Paintbox1.Canvas.Font.
Name:='
Arial';
Paintbox1.Canvas.Font.Size:=48;
paintbox1.Canvas.Brush.Style:=bsClear;
PaintBox1.Canvas.pen.Width:=3;
TextOutAngle(Paintbox1.Canvas, 290, 190, '
Textdrehung', i);
Sleep(100);
inc(i, 10);
ClearPaintBox(
nil);
end;
end;
end.