Home > Software design >  Can you use GIF in Delphi 11?
Can you use GIF in Delphi 11?

Time:07-26

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?

CodePudding user response:

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;
  • Related