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:
- add a
TImage
to a form - load a
GIF
image to theTImage
- 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;