Erick Landim
Erick Landim

Reputation: 35

Can you use GIF in Delphi 11?

Is there a way to use GIFs in Delphi 11? I tried several different ways and I never get a result.

I tried to install the TRxLib package, but inside it does not come with RXgifAnimated, as I had read in a question. Maybe because mine is Delphi 11?

Well, is there a way?

Upvotes: 2

Views: 915

Answers (1)

Tom Brunberg
Tom Brunberg

Reputation: 21045

You can use a TImage to display an animated GIF image.

Example:

  1. add a TImage to a form
  2. load a GIF image to the TImage
  3. in a button click handler write following code:

Note! If you don't load a GIF image at design time, you must manually add the Vcl.Imaging.GIFImg unit to the uses.

procedure TForm4.Button1Click(Sender: TObject);
begin
  with (Image1.Picture.Graphic as TGifImage) do
  begin
    AnimationSpeed := 100;  // percent of normal speed, range 0 through 1000
    Animate := True;
  end;
end;

Upvotes: 5

Related Questions