我看到一些程序如豪杰超级解霸在播放的时候程序的图标是动态的,请问如何在DELPHI中实现

解决方案 »

  1.   

    It's very easy,You can lean it from many books.
      

  2.   

    下面是伪代码
    timer事件
    var i:integer;
    begin
       case i do
        1:显示图片1;
        2:显示图片2;
        3:i:=1;
        end;
      i:=i+1;
    end;
      

  3.   

    unit WorldF;interfaceuses Windows, Classes, Graphics, Forms, Controls, Buttons,
      StdCtrls, ExtCtrls, SysUtils;type
      TWorldForm = class(TForm)
        WorldButton: TBitBtn;
        Timer1: TTimer;
        Label1: TLabel;
        procedure WorldButtonClick(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        Count: Integer;
      public
        { Public declarations }
      end;var
      WorldForm: TWorldForm;implementation{$R *.DFM}procedure TWorldForm.WorldButtonClick(Sender: TObject);
    begin
      if Timer1.Enabled then
      begin
        Timer1.Enabled := False;
        WorldButton.Caption := '&Start';
      end
      else
      begin
        Timer1.Enabled := True;
        WorldButton.Caption := '&Stop';
      end;
    end;procedure TWorldForm.Timer1Timer(Sender: TObject);
    begin
      Count := (Count mod 16) + 1;
      Label1.Caption := 'Displaying image ' + IntToStr (Count);
      WorldButton.Glyph.LoadFromFile ('w' + IntToStr (Count) + '.bmp');
    end;procedure TWorldForm.FormCreate(Sender: TObject);
    begin
      Count := 1;
    end;end.
      

  4.   

    unit AnimBF;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      ComCtrls, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        Animate1: TAnimate;
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
    var
      hDiff: Integer;
    begin
      Animate1.Parent := Button1;
      hDiff := Button1.Height - Animate1.Height;
      Animate1.SetBounds (hDiff div 2, hDiff div 2,
        Animate1.Width, Animate1.Height);
      Animate1.Active := True;
    end;end.
      

  5.   

    在form上放一个ImageList,放上几个你喜欢的图标,还要放上个Timer,运行。
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ImgList, ExtCtrls;type
      TForm1 = class(TForm)
        Timer1: TTimer;
        ImageList1: TImageList;
        procedure Timer1Timer(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      IconIndex:integer;
    implementation{$R *.dfm}{ TForm1 }procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      IconIndex := IconIndex mod ImageList1.Count; 
      ImageList1.GetIcon(IconIndex,Self.icon);
      Inc(IconIndex); 
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      IconIndex := 0;
    end;end.
      

  6.   

    楼主试试用loadcursorfromfile函数能不能加载。*.ani文件~?
    我手头没delphi没法试。
      

  7.   

    1在窗体上放几个IMAGE控件,分别装入动画图表的各种形态,你可以在网上找到动画图标资源
    2在窗体上放一个TIME时间控件,之后在TIME控件的Timer事件中放入一个循环分别改变窗体的图标为IMAGE空间中的图标句柄