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; //必加此二單元