社区
Delphi
帖子详情
如何调用RES文件里的gif图片!小弟万分感谢,在线等待。。
yangzong20
2011-02-18 05:14:08
我编译了一个RES文件其中把一个gif图片编译进去了,变量名为H2!现在我不知道如何在程序里面调用这个gif图片赋值给Image1控件(注明一点,我的Image1控件是支持gif图片的)。我知道如何调用bmp图片但我不知道如何调用gif图片,请高手指导,小弟万分感谢,在线等待。。
...全文
62
4
打赏
收藏
如何调用RES文件里的gif图片!小弟万分感谢,在线等待。。
我编译了一个RES文件其中把一个gif图片编译进去了,变量名为H2!现在我不知道如何在程序里面调用这个gif图片赋值给Image1控件(注明一点,我的Image1控件是支持gif图片的)。我知道如何调用bmp图片但我不知道如何调用gif图片,请高手指导,小弟万分感谢,在线等待。。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
kye_jufei
2011-02-19
打赏
举报
回复
[code=Delphi(Pascal]unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls,GIFImage, StdCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{$R sample.RES}
procedure TForm1.FormCreate(Sender: TObject);
var
Streams:TStream;
gif:TGIFImage;
begin
try
DeleteFile(PChar(ExtractFilePath(ParamStr(0))+'abc.gif'));
Streams:=TResourceStream.Create(hInstance,'Mygif','gif');
try
gif:=TGIFImage.Create;
try
gif.LoadFromStream(Streams);
Image1.Picture.Assign(gif);
finally
gif.Free;
end;
finally
Streams.Free;
end;
except
end;
end;[/code]
kye_jufei
2011-02-19
打赏
举报
回复
[code=Delphi(Pascal]unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls,GIFImage, StdCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{$R sample.RES}
procedure TForm1.FormCreate(Sender: TObject);
var
Streams:TStream;
gif:TGIFImage;
begin
try
DeleteFile(PChar(ExtractFilePath(ParamStr(0))+'abc.gif'));
Streams:=TResourceStream.Create(hInstance,'Mygif','gif');
try
gif:=TGIFImage.Create;
try
gif.LoadFromStream(Streams);
Image1.Picture.Assign(gif);
finally
gif.Free;
end;
finally
Streams.Free;
end;
except
end;
end;
end.[/code]
kye_jufei
2011-02-19
打赏
举报
回复
抽了點時間,給你寫了一個demo,測試過過:
資源文件定義如下:(abc.gif為gif圖片檔案)
[code=HTM]Mygif gif abc.gif[/code]
example:
[code=Delphi(Pascal]unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls,GIFImage, StdCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{$R sample.RES}
procedure TForm1.FormCreate(Sender: TObject);
var
Streams:TStream;
gif:TGIFImage;
begin
try
DeleteFile(PChar(ExtractFilePath(ParamStr(0))+'abc.gif'));
Streams:=TResourceStream.Create(hInstance,'Mygif','gif');
try
gif:=TGIFImage.Create;
try
gif.LoadFromStream(Streams);
Image1.Picture.Assign(gif);
finally
gif.Free;
end;
finally
Streams.Free;
end;
except
end;
end;
end.[/code]
贝隆
2011-02-19
打赏
举报
回复
我的印象中Res文件不支持GIF
Nodejs详解
当 Node.js 执行 I/O 操作时(例如从网络读取、访问数据库或
文件
系统),Node.js 会在响应返回时恢复操作,而不是阻塞线程并浪费 CPU 循环
等待
。 这使 Node.js 可以在一台服务器上处理数千个...
在Delphi中编辑res
文件
先用记事本编写一个rc的
文件
。...选中这两个
文件
,拉到“brc32.exe”
文件
上面,就会生产一个res格式的
文件
出来。
文件
名称为跟rc
文件
的名称一样。 1.创建资源
文件
首先创建一个.Rc的纯文本
文件
。格式如下:
制作RES资源
文件
[转贴] 谈资源
文件
在delphi中的应用 资源
文件
一般为扩展名为res的
文件
。在vc中资源
文件
用得非常普遍, 但delphi在其联机帮助中对资源
文件
没作什么介绍,其实利用其自带的 资源编译工具brcc32.exe(一般位于/delphi/...
从DLL
里
调用
图片
-笔记
用VS查看RES
文件
,在VS
里
查看不到
图片
,全是些二进制代码!但是查看系统的RES
文件
(在我这
里
查看的就是程序本身的RES
文件
,与自己的程序同名),则可以查看到Delphi的经典图标:)。然后我直接用VS制作RES,用导入...
Android动态加载—Res
文件
简介动态加载res
文件
,就是将资源
文件
打包进一个统一的apk,而在我们的app安装后通过后台下载,然后再写到我们的应用中,将这个含有资源的apk,可以称为插件apk,而我们的app,可以称为宿主apk,在宿主中加载插件中的资源...
Delphi
5,388
社区成员
262,730
社区内容
发帖
与我相关
我的任务
Delphi
Delphi 开发及应用
复制链接
扫一扫
分享
社区描述
Delphi 开发及应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章