Delphi 怎样 把TParams 或 record写到流里面

前端之家收集整理的这篇文章主要介绍了Delphi 怎样 把TParams 或 record写到流里面前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
type   TRec=Record     msg:string;     pic:TMemoryStream; end; procedure TForm2.BitBtn1Click(Sender: TObject); var   ms:TMemoryStream;   Rec1,Rec2:TRec;   cc:tmemorystream;   jpg:TJPEGImage; begin   Rec1.msg:='Hello World';   Rec1.pic := tmemorystream.Create;   image1.Picture.Graphic.SaveToStream( Rec1.pic );   Rec1.pic.Position := 0;   ms:=TMemoryStream.Create;   ms.Write(Rec1,SizeOf(Rec1));   ms.Position:=0;   ms.Read(Rec2,SizeOf(Rec2));   ms.Free;   ShowMessage(Rec2.msg);   jpg := tjpegimage.Create;   jpg.LoadFromStream(Rec2.pic);   image2.Picture.Assign(jpg)   //image2.Picture.Graphic.LoadFromStream( Rec2.pic ); end;

猜你在找的Delphi相关文章