IStream与TStream之间的相互转换
程序员文章站
2022-03-23 08:04:33
procedure tform1.button1click(sender: tobject); &nbs...
procedure tform1.button1click(sender: tobject);
var
memostream,olestream:tstream;
stream : istream;
begin
image1.picture :=nil;
image2.picture :=nil;
//显示初始照片
image1.picture.loadfromfile('c:\logo.bmp');
memostream := tmemorystream.create;
try
//将照片保存为tmemorystream
image1.picture.bitmap.savetostream(memostream);
memostream.position :=0;
//将tmemorystream转成istream
stream:=tstreamadapter.create(memostream);
//将istream转成tolestream ==tmemorystream
olestream := tolestream.create(stream);
image2.picture.bitmap.loadfromstream(olestream);
finally
memostream.free;
olestream.free;
end;
end;
///////////////////////////
uses
....................axctrls,activex; //必加此二单元
上一篇: 中美就WAPI申请国际标准达成一致
下一篇: ASP.NET MVC 过滤器(三)