使用TImage浏览与保存网络图像

网络ID:wnhoo or sos_admin
网名:e梦缘
Mail: [email protected]
风花雪月 e梦情缘

http://delphi.ktop.com.tw/delphi.gif 直接显示在timage中!

保存为文件,然后显示:

uses UrlMon ;
function DownLoadInternetFile(Source, Dest : String) : Boolean;
begin
try
Result := URLDownloadToFile(nil,PChar(Source),PChar(Dest),0,nil) = 0
except
Result := False;
end;
end;

保存为Tsream,然后显示:
procedure TForm1.Button1Click(Sender: TObject);
var
tm: TMemoryStream;
begin
try
tm := TMemoryStream.Create;
IdHTTP1.Get(' http://delphi.ktop.com.tw/delphi.gif', tm);
ShowMessage('OK');
finally
tm.Free;
end;
end;

Published At
Categories with Web编程
Tagged with
comments powered by Disqus