如何使用Delphi形式的动画Gif [英] How to use Animated Gif in a delphi form
问题描述
我认为没有本地支持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属性中。然后,通过 动画$ c启动动画$ c>
属性:
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;
您可以使用 AnimateLoop
和 AnimateSpeed
。应该很容易猜到如何关闭动画!
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的网站下载代码(您需要最新版本的 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
代码只是相同组件的版本,最初由安德斯Melander ,并于2007年捐赠给Embarcadero纳入德尔福。
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屋!