TynSerial圖片序列(還原)url
筆者以生成圖形驗證碼爲例。code
function TForm1.VerifyCode(image: TImage): string; // 生成驗證碼和圖像 var url: SockString; serial: TynSerial; i: Integer; ms: TMemoryStream; begin serial := TynSerial.Create; ms := TMemoryStream.Create; try url := 'verifycode'; i := FHttp.Post(url, '', FDataType); if i = 200 then begin serial.Text := FHttp.Content; Result := serial.ReadString('code'); serial.ReadStream('image', ms); ms.Position := 0; image.Picture.Bitmap.LoadFromStream(ms); end else ShowMessage(IntToStr(i) + ' error'); finally serial.Free; ms.Free; end; end;