Form - Icone Animado Quando Minimizado

Top  Previous  Next

// Quando o form for minimizado o seu icone ficara animado atraves das

// animacoes de um imagelist

 

 

type

  TForm1 = class(TForm)

    ImageList1: TImageList;

    Timer1: TTimer;

    procedure Timer1Timer(Sender: TObject);

  private

    IconeAtu : Integer;

  end;

 

var

  Form1: TForm1;

 

implementation

 

{$R *.DFM}

 

procedure TForm1.Timer1Timer(Sender: TObject);

begin

  // so mostra ícone se a aplicação estiver minimizada

  if IsIconic(Application.Handle) then

  begin

    // pega ícone da ImageList

    ImageList1.GetIcon(IconeAtu,Application.Icon);

    // atualiza o ícone

    InvalidateRect(Application.Handle, nil, True);

    // incrementa índice do ícone

    if IconeAtu >= 9 then

      IconeAtu := 0

    else

      Inc(IconeAtu);

  end;

end;