Unit Unit1;
Interface
Uses Windows, Messages, SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;
Type TForm1 =
Class(TForm)
Timer1: TTimer;
OpenDialog1: TOpenDialog;
Procedure FormCreate(Sender: TObject);
Procedure FormDestroy(Sender: TObject);
Procedure Timer1Timer(Sender: TObject);
End;
Var Form1: TForm1;
Nachricht:
String;
Canv: TCanvas;
Implementation
{$R *.dfm}
Procedure TForm1.FormCreate(Sender: TObject);
Begin
Canv := TCanvas.Create;
Canv.Handle := GetWindowDC(0);
OpenDialog1.Execute;
Nachricht := ExtractFileName(OpenDialog1.FileName);
With Canv
do Begin
Font.
Name := '
Arial';
Font.Size := 24;
Font.Color := clRed;
Brush.Style := bsClear;
Pen.Mode := pmNotXor;
End;
Timer1.Enabled := True;
End;
Procedure TForm1.FormDestroy(Sender: TObject);
Begin
Timer1.Enabled := False;
If Timer1.Tag <> 0
Then Begin
(* Text löschen *)
Canv.TextOut(Screen.Width
div 2 - Canv.TextWidth(Nachricht)
div 2,
Screen.Height
div 2 - Canv.TextHeight(Nachricht)
div 2, Nachricht);
Timer1.Tag := 0;
End;
Canv.Free;
End;
Procedure TForm1.Timer1Timer(Sender: TObject);
Begin
(* Text zeichnen und/oder löschen *)
Canv.TextOut(Screen.Width
div 2 - Canv.TextWidth(Nachricht)
div 2,
Screen.Height
div 2 - Canv.TextHeight(Nachricht)
div 2, Nachricht);
If Timer1.Tag = 0
Then Timer1.Tag := 1
Else Timer1.Tag = 0;
End;
End.