在DELPHI中显示GIF动画
想没想过在DELPHI中显示GIF动画?Delphi的用户是非常幸运的,因为有免费控件可以使用。最著名的控件是Anders Melander编写的TGifImage,并提供完整的源程序。它原来的主页是www.melander.dk/delphi/gifimage/,不过有很长时间没有更新了。如果要在新版本的Delphi中使用,可以从http://finn.mobilixnet.dk/delphi/下载Finn Tolderlund改写的Delphi 5/6/7版本的TGifImage。 现在看看怎么在DELPHI中使用GIFImage.pas文件,显示GIF动画首先,新建一个工程,在Project-OPTIONS菜单中的Directories/Conditionals页中的search中添加一个路径,这个路径指向GIFImage.pas所在文件夹然后在FORM1的PUBLIC区添加一个变量GIF,定义为TGIFImage类型在form1的onCreate中添加代码:GIF := TGIFImage.Create; 在form1上添加一个按钮button1,添加一个image控件在button1的click事件中添加代码: Gif.LoadfromFile('d:\abc.gif'); GIF.Paint(Image1.Canvas,Image1.ClientRect,[goAsync,goLoop,goAnimate]);
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,GIFImage, ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Timer1: TTimer;
Panel1: TPanel;
Image2: TImage;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
i:integer;
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
gif:TGIFImage;
gif1:TGIFImage;
begin
//include(GIFImageDefaultDrawOptions, goDirectDraw);
gif:=TGIFImage.Create;
gif1:=TGIFImage.Create;
gif.LoadfromFile('test.gif');
gif1.LoadfromFile('test.gif');
try
GIF.Paint(Image1.Canvas,Image1.ClientRect,[goTransparent,goDither,goAsync,goLoop,goAnimate,goDirectDraw]);
GIF1.Paint(Image2.Canvas,Image2.ClientRect,[goTransparent,goAsync,goLoop,goAnimate]);
//Image1.Picture.Assign(gif);
//include(GIFImageDefaultDrawOptions, goDirectDraw);
//Image2.Picture.Assign(gif1);
finally
//GIF.Free;
//gif1.Free;
end;
end;
proce
相关文档:
TCollection 是TCollectionItenm对象的一个容器。
类关系TObject→TPersistent
每一个TCollection都拥有一组TCollectionItem对象。
在其Items属性数组中,TCcllection保存集合项目的一个下标。Count 属性包含了集合的项目数量。使用Add和Clear方法可以向集合中加入项目和从集合中删除项目。
从TCollect ......
常忘记,在此做笔记。
这几个函数都包含在StrUtils中,所以需要uses StrUtils;
假设字符串是 Dstr := ’Delphi is the BEST’, 那么
LeftStr(Dstr, 5) := ’Delph’
MidStr(Dstr, 6, 7) := ’ ......
DirectoryExists('C:\WINDOWS'):Boolean;检测文件夹是否存在!
FileExists('c:\Dir.txt'):Boolean;检测文件是否存在!
EDIT组件
OnChange 当编辑框中的内容发生变化时触发该事件
OnKeyPress 当按下一个按键时,触发该事件
OnEnter 编辑框获得输入焦点时,触发该事件
MEMO组合
WordWrap 用于设定Momo组件是否具有自� ......
Wma 格式歌曲信息文件结构,附读写类(Delphi)
linle @ 2006-05-01 13:10
以前的一点研究,公开好了,有什么疑问可以和我讨论
三个多月前的代码,,比较幼稚,大家将就一下吧
文件结构示意图
格式的简单说明:
如图1,每一个WMA文件,它的头16个字节是固定的,为十六进� ......
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, DB, ADODB, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Button ......