Delphi idhttp中get 图像链接通过memorystream加载 image控件显示


本文整理自网络,侵删。

 uses
  jpeg;function TForm1.GetImage(url: string): boolean;
var
  MemoryStream:TMemoryStream;
  Idhttp:TIdhttp;
  Img: TJPEGImage;
begin
  MemoryStream:=TMemoryStream.Create   ;
  Idhttp:=Tidhttp.Create(nil);
  Img := TJPEGImage.Create;
  try
    Idhttp.Get(url,MemoryStream);
    MemoryStream.Position := 0;
    Img.LoadFromStream(MemoryStream);
    Image1.Picture.Bitmap.Assign(Img);
  finally
    MemoryStream.Free   ;
    Idhttp.Free;
    Img.Free;
  end;
end;

相关阅读 >>

Delphi日期和时间

Delphi 读取image组件转换base64编码

Delphi sqlite incomplete input 错误

Delphi-dbgrid取得所有表中的值

Delphi 获取随机字符串的方法 getrandomstring

Delphi 如何将颜色值转换为灰度颜色值?

Delphi(更改图标)

Delphi adoquery连接数据库的查询、插入、删除、修改

Delphi中如何将一整个文件读入内存

Delphi 使用twebbrowser组件保存网页为html和mht文件

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...