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
| procedure TAlerte.FormCreate(Sender: TObject);
begin
BorderStyle := bsNone;
Left :=Screen.DesktopWidth - Width-2;
Top :=Screen.DesktopHeight + Height;
Timer1.Interval := 10000;
Timer1.Enabled := False;
end;
procedure TAlerte.FormActivate(Sender: TObject);
begin
while Top<>Screen.DesktopHeight-Height do
begin
Update;
Top := Top-1;
Sleep(2);
end;
Timer1.Enabled := True;
end;
procedure TAlerte.FormClose(Sender: TObject; var Action: TCloseAction);
begin
try
while Top<>Screen.DesktopHeight+Height do
begin
Top := Top+1;
Sleep(2);
end
finally
Action := CaFree;
Alerte := nil;
end;
end;
procedure TAlerte.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := False;
Close;
end;
procedure TAlerte.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
Alerte.Close;
end;
procedure TAlerte.FormPaint(Sender: TObject);
var
OTopColor, OBottomColor : TColor;
ITopColor, IBottomColor : TColor;
Orec,Irec : TRect;
begin
OTopColor := clBtnface;
OBottomColor := clBlack;
ITopColor := clBtnHighlight;
IBottomColor := clBtnShadow;
Orec := Rect(0,0,width,Height);
Irec := Rect(1,1,width-1,Height-1);
Frame3D(Canvas, Orec , OTopColor, OBottomColor, 1);
Frame3D(Canvas, Irec , ITopColor, IBottomColor, 1);
end;
------------------------------------------
Le code appelant depuis une autre fiche:
begin
if Alerte = nil then
Alerte := TAlerte.Create(Self);
Alerte.show;
end; |
Partager