播放动画图像

时间:2022-08-23 07:26:20
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Animate1: TAnimate;
    Animate2: TAnimate;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  animate1.Play(animate1.StartFrame,animate1.StopFrame,0);   //播放起始帧
  animate2.Play(animate2.StartFrame,animate2.StopFrame,0);
  button2.Enabled := true;
  button3.Enabled := true;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  animate1.Seek(12);                                         //显示第12帧图像,不再继续播放
  animate2.Seek(12);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  animate1.Stop;
  animate2.Stop;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  button2.Enabled := false;
  button3.Enabled := false;
end;

end.

 

播放动画图像