如何以 delphi 形式使用动画 Gif [英] How to use Animated Gif in a delphi form

查看:31
本文介绍了如何以 delphi 形式使用动画 Gif的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为没有对 gif 动画图像的原生支持.

I think theres no native support to gif animated images.

最好的方法是什么?任何允许这样做的免费组件?我正在考虑使用 TImage 和 ImageList + Timer,但我需要将 gif 的每一帧导出到一个单独的 bmp 文件.

How is the best way? any free component that allow that? I was thinking in using a TImage and a ImageList + Timer, but I need to export each frame of the gif to a separated bmp file.

推荐答案

这在现代 Delphi 中非常简单.这一切都是内置的.将 TImage 拖放到表单上,然后将动画 GIF 加载到 Picture 属性中.然后,通过 Animate 属性:

It's pretty simple in modern Delphi. It's all built in. Drop a TImage onto the form and load the animated GIF into the Picture property. Then, start the animation by means of the Animate property:

(Image1.Picture.Graphic as TGIFImage).Animate := True;

您可以使用 AnimateLoopAnimateSpeed.应该很容易猜到如何再次关闭动画!

You can control the animation with AnimateLoop and AnimateSpeed. It should be pretty easy to guess how to switch the animation off again!

现在,由于您使用的是 Delphi 7,因此您没有内置 TGIFImage 组件.但是,您可以从 Finn Tolderlund's 网站下载代码(您需要最新版本的 TGIFImage).使用这个版本的组件,上面的代码应该可以正常工作,尽管我个人自从几年前从 D6 移植到 D2010 后就没有使用过它.

Now, since you are using Delphi 7, you don't have the TGIFImage component built-in. However, you can download the code from Finn Tolderlund's website (you want the latest version of TGIFImage). With this version of the component, the code above should work fine, although I personally have not used it since I ported from D6 to D2010 a few years back.

所有这些不同的 TGIFImage 代码实际上只是同一组件的版本,最初由 Anders Melander 编写 并于 2007 年捐赠给 Embarcadero 以纳入 Delphi.

All these various TGIFImage codes are really just versions of the same component, originally written by Anders Melander and, in 2007, donated to Embarcadero for inclusion in Delphi.

这篇关于如何以 delphi 形式使用动画 Gif的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆