急需(10分)

  • 主题发起人 主题发起人 piaoyun1987
  • 开始时间 开始时间
P

piaoyun1987

Unregistered / Unconfirmed
GUEST, unregistred user!
各位朋友,由于我的积分几乎用完,请各位原谅<br>如何把数据库中保存的图片显示出来,用 image 显示
 
use<br>&nbsp; JPEG;<br>var<br>&nbsp; &nbsp;Mem:TStream;<br>&nbsp; &nbsp;MJPEG: TJPEGImage;<br>&nbsp; &nbsp;Str:String;<br>begin<br>&nbsp; &nbsp;Str:='';<br>&nbsp; &nbsp;with DataSource1.DataSet do<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp;First;<br>&nbsp; &nbsp;while not Eof do<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp;if FieldByName('Filename').AsString=Str then<br>&nbsp; &nbsp;break;<br>&nbsp; &nbsp;Next;<br>&nbsp; &nbsp;MJpeg:=TJpegImage.Create;<br>&nbsp; &nbsp;Mem:=CreateBlobStream(FieldByName('Picture'),bmRead);<br>&nbsp; &nbsp;Mem.Position:=0;<br>&nbsp; &nbsp;MJpeg.LoadFromStream(mem);<br>&nbsp; &nbsp;self.Image1.Picture.Assign(MJpeg);<br>&nbsp; &nbsp;AJpeg.Free;<br>&nbsp; &nbsp;mem.Free;<br>&nbsp; &nbsp;end;<br>end;
 
后退
顶部