频道分类

Delphi 内存流方式获取页面验证码图片

作者:admin 来源: 日期:2020/1/31 18:52:45 人气: 标签:

 

显示图片

 

var

  png: TPngImage;

begin

  png := TPngImage.Create;

  png.LoadFromFile('F:\DelphiSource\yzm_demo\Win32\Debug\yzm.png');

  img1.Picture.Bitmap.Assign(png);

  img1.AutoSize := True;

end;

 

内存流方式获取页面验证码图片

procedure TForm1.Button2Click(Sender: TObject);

var

ms:TMemoryStream;

jpg:TJpegImage;

vp:string;

begin

ms:=TMemoryStream.Create;

jpg:=TJpegimage.Create;

vp:='http://ptlogin2.qq.com/getimage?aid=15000102&0.04531191241475274';

IdHTTP1.Get(vp,ms);

ms.Position:=0;

jpg.LoadFromStream(ms);

image1.Picture.Assign(jpg);

ms.Free;

jpg.free;

end;

来源:http://www.coder163.com/language/delphi/