Lenguaje de programación Borland Delphi
Necesitará: un TTimer (Temporizador, está en la paleta de componentes, en la pestaña System), cuatro TImage (está en la paleta de componentes, en la pestaña Additional), cada TImage llevará en la propiedad Picture un icono sucesivo para la animación:
unit Unit1;
interface
uses
Windows, Messages, Classes, Graphics, Controls, Forms, StdCtrls,
ExtCtrls, ImgList;
type
TForm1 = class(TForm)
Button1: TButton;
Timer1: TTimer;
Image1: TImage;
Image2: TImage;
Image3: TImage;
Image4: TImage;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
// Guarda el icono que se está mostrando actualmente
var
estadoActual : byte = 1;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if IsIconic(Application.Handle) then
begin
case estadoActual Of
1: Application.Icon := Image1.Picture.Icon;
2: Application.Icon := Image2.Picture.Icon;
3: Application.Icon := Image3.Picture.Icon;
4: Application.Icon := Image4.Picture.Icon;
end;
InvalidateRect(Application.Handle, nil, True);
if (estadoActual >= 4) then
estadoActual := 1
else
inc(estadoActual);
end;
end;
end.
Publicado el: 2003-09-19