|
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; //必加此二單元
php技術:IStream與TStream之間的相互轉換,轉載需保留來源!
鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。