For BMP, directly display it in some TImage component. For others like JPEG and GIF, you should use JPEG unit or TGIFImage component. JPEG support is enclosed in Delphi while TGIFImage component is a popular component you can dowload from web, and it is aldo free.

解决方案 »

  1.   

    可以先把数据库中的数据存入一个临时的Blob流里面,然后Tbmp导出就可以了
      

  2.   

    如果用DBimage会出现"Bitmap image is not valid!"
    我也想到了用临时文件,但前两天才刚开始第一次用DELPHI开发软件,还不熟习DELPHI对文件的操作!也不知道什么是Blob流!哪位帮帮忙?有示例代码最好!先谢了!
      

  3.   

    那么如何将Adoquery.FieldValues['IMG']读出的数据转为Blob流呢?谢了!
      

  4.   

    tblobfield(adoquery.fieldbalues['img']).value
      

  5.   

    var
      ms:tmemorystream;
      jp:TJpegImage;
    begin
      ms:=tmemorystream.Create;
      jp:=TJpegImage.Create;
      try
        with ADOQuery1 do
        begin
          Open;
          First;
          MoveBy(StrToInt(Edit1.Text));
          TBlobField(FieldByName('i')).SaveToStream(ms);
          Close;
        end;
        ms.Position:=0;
        jp.LoadFromStream(ms);
        Image1.Picture.Bitmap.Assign(jp);
      finally
        ms.Free;
        jp.Free;
      end;
    end;
      

  6.   

    MoveBy(StrToInt(Edit1.Text));//没用      
      

  7.   

    Stream:=TBlobStream.Create(FieldByName('img') as TBlobField, bmRead);
    这样写,为什么显示错误"Invalid class typecast."
      

  8.   

    TBlobField(FieldByName('i')).SaveToStream(ms);
    出错吗?
      

  9.   

    没错,先谢了!
    为什么
    Stream:=TBlobStream.Create(FieldByName('img') as TBlobField, bmRead);
    Stream.SaveToStream(ms);
    不可以?
    我第一次用DELPHI开发软件,也是摹仿来的!
      

  10.   

    Stream:=TBlobStream.Create(FieldByName('img') as TBlobField, bmRead);
    Stream.SaveToStream(ms);
    哪句错?
    我也没用过这个