3

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?

Community
  • 1
  • 1
Rebelss
  • 364
  • 1
  • 5
  • 15

2 Answers2

8

Required unit:

uses Vcl.Imaging.GIFImg

Code to animate:

TGIFImage(Image1.Picture.Graphic).Animate := True;
dataol
  • 999
  • 3
  • 19
  • 42
7

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

Community
  • 1
  • 1
LU RD
  • 34,438
  • 5
  • 88
  • 296
  • Thx, you answer was more complete. – Rebelss Jan 07 '13 at 19:06
  • 2
    If anyone was wondering how to do this in C++ builder: `((TGIFImage*)(Image1->Picture->Graphic))->Animate = true` – Swen Kooij Dec 16 '13 at 15:13
  • TImage in Xe6 does not have Picture.Graphic and tGifImage How can do it in XE6? – Amin Sep 07 '14 at 06:30
  • @Amin, XE6 VCL TImage definitely has Picture.Graphic properties. Did you include Vcl.Imaging.GIFImg? Or are you using FireMonkey? – LU RD Sep 07 '14 at 06:58
  • @LURD Yes I am using FireMonkey. – Amin Sep 15 '14 at 05:18
  • @Amin, then I suggest you read [Animated GIF in Firemonkey](http://stackoverflow.com/a/13418987/576719) where a possibility is to use [TBitmapListAnimation](http://docwiki.embarcadero.com/Libraries/en/FMX.Ani.TBitmapListAnimation). – LU RD Sep 15 '14 at 17:11