1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls,Math;
type TForm1 = class(TForm) Timer1: TTimer; procedure Timer1Timer(Sender: TObject); procedure FormCreate(Sender: TObject); private procedure DoFrame; public { Public-Deklarationen } end; var Form1: TForm1; Canvas : TCanvas; iY,iStep: Integer; s1,sDraw: String; bRunning: Boolean;
implementation
{$R *.dfm}
procedure TForm1.DoFrame; const TitelFontSize=24; ResolutionX=1024; var c1: TCanvas; iInc: Integer; begin iInc:=1; repeat s1:=UpperCase(s1); c1:=TCanvas.Create; c1.Handle:=Canvas.Handle; with c1.Font do begin Style:=[fsBold]; Color:=clGreen; Name:='Verdana'; Size:=Ceil((TitelFontSize*(4/(iInc+3)))*(Self.Width/ResolutionX)); if c1.TextWidth(s1)>Self.Width*(60/100) then Size:=Round((Size * 60 * Self.Width)/(100 * c1.TextWidth(s1))); end;
iY:=(Height div 2)-((Abs(c1.Font.Height)) div 2); Inc(iInc); until iY>0;
sDraw:=s1; iStep:=Length(sDraw); Canvas.Font:=c1.Font; Timer1.Enabled:=true; while Timer1.Enabled and bRunning do begin Application.ProcessMessages; sleep(1); end;
c1.Free; end;
procedure TForm1.Timer1Timer(Sender: TObject); var iCenterX: Integer; sTmp: String; begin Dec(iStep); sTmp:=Copy(sDraw,1,Length(sDraw)-iStep); iCenterX:=(Width div 2)-(Canvas.TextWidth(sTmp) div 2); Canvas.TextOut(iCenterX,iY,sTmp); if iStep<=0 then Form1.Timer1.Enabled:=false; end;
procedure TForm1.FormCreate(Sender: TObject); begin s1:='Das ist mein Text!'; DoFrame end;
end. |