Animated gif in Delphi XE 3 forms [duplicate]

2019-07-05 22:31发布

问题:

Possible Duplicate:
How to use Animated Gif in a delphi form

I recently updated my version of Delphi 7 to Delphi XE3.

Using Delphi 7, I used a component to put a GIF on a TImage, delphi XE3 already has compatibility with gif's, it is not necessary to install any additional third party components.

my question is: when I attach the gif to TImate, it becomes static, shows only the first frame.

is there any command for this? like Image1.Play or something?

回答1:

To get the animation started do like this:

(Image1.Picture.Graphic as TGIFImage).AnimateLoop := glEnabled;
(Image1.Picture.Graphic as TGIFImage).Animate := true;

To control the animation speed, set the AnimationSpeed property between 0..1000, default value is 100.

See also @DavidHeffernan's answer, How to use Animated Gif in a delphi form



回答2:

Required unit:

uses Vcl.Imaging.GIFImg

Code to animate:

TGIFImage(Image1.Picture.Graphic).Animate := True;