各位大虾帮忙看一下代码,为什么这样图像不会像是出来(100分)

  • 主题发起人 主题发起人 xchen.d
  • 开始时间 开始时间
X

xchen.d

Unregistered / Unconfirmed
GUEST, unregistred user!
我的代码如下:我把stream保存为图片文件时可以,但直接访问stream(loadfromstream)却不行
var
spic: TMemoryStream;
x: TIdHTTP;
begin
spic := TMemoryStream.Create;
x := TIdHTTP.Create(nil);
x.Get('http://www.hftoy.com/tphoto/zlb/HF19638.jpg', spic);
x.Free;
Image1.Picture.Graphic.LoadFromStream(spic);
spic.Free;
end;
 
刷新一下看看
 
image1.refresh
没用
image1.repaint
也没用
 
x.Free;
加一句试试:spic.seek(0,sofrombeginning);
Image1.Picture.Graphic.LoadFromStream(spic);
spic.Free;
 
var
spic: TMemoryStream;
x: TIdHTTP;
begin
spic := TMemoryStream.Create;
x := TIdHTTP.Create(nil);
x.Get('http://www.hftoy.com/tphoto/zlb/HF19638.jpg', spic);
x.Free;
[red]spic.Position := 0;[/red]
Image1.Picture.Graphic.LoadFromStream(spic);
spic.Free;
end;
 
后退
顶部