Delphi 11 可以使用 GIF 吗?

Eri*_*dim 2 delphi animation gif animated-gif

有没有办法在 Delphi 11 中使用 GIF?我尝试了几种不同的方法,但从未得到结果。

我尝试安装 TRxLib 包,但里面没有 RXgifAnimated,正如我在一个问题中读到的那样。也许是因为我的是Delphi 11?

嗯,有办法吗?

Tom*_*erg 5

您可以使用 aTImage来显示动画 GIF 图像。

例子:

  1. 将 a 添加TImage到表单
  2. 加载GIF图像到TImage
  3. 在按钮单击处理程序中编写以下代码:

笔记!如果您在设计时未加载 GIF 图像,则必须手动将Vcl.Imaging.GIFImg单元添加到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;
Run Code Online (Sandbox Code Playgroud)