W woofer Unregistered / Unconfirmed GUEST, unregistred user! 2001-06-22 #1 interbase数据库中的一个表中有一个BLob字段,用来保存图象。 如何把改字段地图象赋值给一个TImage对,使它能够显示出来
S sonie Unregistered / Unconfirmed GUEST, unregistred user! 2001-06-22 #4 多种方法,这个是我用的 image.picture.assign(table.fieldbyname('picture字段'));
K kals Unregistered / Unconfirmed GUEST, unregistred user! 2001-06-22 #5 如果是用QUERY 打开QUERY之后 image.picture.assign(query1['BLOB字段']);
C citybug Unregistered / Unconfirmed GUEST, unregistred user! 2001-06-22 #6 用流很麻烦,如果没有必要还是存储路径吧,虽然方法简单一些,可是也能避免很多问题。
W woofer Unregistered / Unconfirmed GUEST, unregistred user! 2001-06-22 #7 ImgHistory.Picture.Assign (MyData.IBQry['GRAPH']); 这句话出现了这样的错误 [Error] CurveSelFrom.pas(264): Incompatible types: 'TPersistent' and 'Variant' 不对阿
ImgHistory.Picture.Assign (MyData.IBQry['GRAPH']); 这句话出现了这样的错误 [Error] CurveSelFrom.pas(264): Incompatible types: 'TPersistent' and 'Variant' 不对阿
S simbasun Unregistered / Unconfirmed GUEST, unregistred user! 2001-06-22 #8 procedure TForm1.btnShowBlobClick(Sender:TObject); var sFileName : String; BS : TADOBlobStream; begin BS := TADOBlobStream.Create(TBlobField(adodsBlobs.FieldByName('Blobs')),bmRead); try sFileName := ExtractFilePath(Application.ExeName) + 'tmpBlob.bmp'; BS.SaveToFile(sFileName); image.picture.LoadFromFile('sFileName'); finally BS.Free; end; end;
procedure TForm1.btnShowBlobClick(Sender:TObject); var sFileName : String; BS : TADOBlobStream; begin BS := TADOBlobStream.Create(TBlobField(adodsBlobs.FieldByName('Blobs')),bmRead); try sFileName := ExtractFilePath(Application.ExeName) + 'tmpBlob.bmp'; BS.SaveToFile(sFileName); image.picture.LoadFromFile('sFileName'); finally BS.Free; end; end;
W woofer Unregistered / Unconfirmed GUEST, unregistred user! 2001-06-24 #9 我没有用ADO啊。 TBlobStream好像没有SaveToFile方法。 谁能仔细的解释一下TBlobStream的用法。 不用Blob流,直接Assign会出错啊。
Z zhoucan790322 Unregistered / Unconfirmed GUEST, unregistred user! 2001-06-24 #11 var TempStream: TMemoryStream; begin TempStream := TMemoryStream.Create; try TBlobField(Table1.FieldByName('Blobs')).SaveToStream(TempStream); TempStream.Position := 0; Image1.Picture.Assign(TempStream); finally TempStream.Free; end; end; 别忘了给我加分。多谢
var TempStream: TMemoryStream; begin TempStream := TMemoryStream.Create; try TBlobField(Table1.FieldByName('Blobs')).SaveToStream(TempStream); TempStream.Position := 0; Image1.Picture.Assign(TempStream); finally TempStream.Free; end; end; 别忘了给我加分。多谢
W woofer Unregistered / Unconfirmed GUEST, unregistred user! 2001-06-24 #12 我存图象是这样做的 tBlobField(FieldByName('GRAPH')).assign(image1.picture.graphic); post; 显示时是这样 TempStream := TMemoryStream.Create; try TBlobField(FieldByName('GRAPH')).SaveToStream(TempStream); TempStream.Position := 0; imgHistory.Picture.Graphic.Assign(TPersistent(TempStream)); finally TempStream.Free; end; 但是图象显示不出来,但是没有错误 各位高手帮帮忙啊
我存图象是这样做的 tBlobField(FieldByName('GRAPH')).assign(image1.picture.graphic); post; 显示时是这样 TempStream := TMemoryStream.Create; try TBlobField(FieldByName('GRAPH')).SaveToStream(TempStream); TempStream.Position := 0; imgHistory.Picture.Graphic.Assign(TPersistent(TempStream)); finally TempStream.Free; end; 但是图象显示不出来,但是没有错误 各位高手帮帮忙啊