欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

IStream與TStream之間的相互轉(zhuǎn)換

 更新時(shí)間:2008年08月01日 00:48:51   作者:  
IStream與TStream之間的相互轉(zhuǎn)換的代碼
  
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轉(zhuǎn)成IStream    
    stream:=TStreamAdapter.Create(memoStream);    

  //將IStream轉(zhuǎn)成TOleStream ==TmemoryStream    
    OleStream := TOleStream.Create(Stream);    
    image2.Picture.Bitmap.LoadFromStream(OleStream);    
  finally   
    memoStream.Free;    
    OleStream.Free;    
  end;    
end;    

   
///////////////////////////    

uses   

....................AxCtrls,ActiveX;    //必加此二單元

相關(guān)文章

最新評(píng)論