R
rickylin
Unregistered / Unconfirmed
GUEST, unregistred user!
我用了网上这个方法不行,总是提示"jpeg error #41"或者"jpeg error #50".
下面的这段代码是在按了“查看图像”按钮之后所触发的事件处理程序:
procedure TForm1.Button1Click(Sender: TObject);
var tempstream:TStringStream;
tempjpeg:TJPEGImage;
begin
try
tempstream:=TStringStream.Create(' ');
TBlobField(Query1.FieldByName('Image')).SaveToStream(tempstream);
tempstream.Position:=0;
tempjpeg:=TJPEGImage.Create;
tempjpeg.LoadFromStream(tempstream);
DBImage1.Picture.Bitmap.Assign(tempjpeg);
finally
tempstream.Free;
tempjpeg.Free;
end;
end;
下面的这段代码是在按了“查看图像”按钮之后所触发的事件处理程序:
procedure TForm1.Button1Click(Sender: TObject);
var tempstream:TStringStream;
tempjpeg:TJPEGImage;
begin
try
tempstream:=TStringStream.Create(' ');
TBlobField(Query1.FieldByName('Image')).SaveToStream(tempstream);
tempstream.Position:=0;
tempjpeg:=TJPEGImage.Create;
tempjpeg.LoadFromStream(tempstream);
DBImage1.Picture.Bitmap.Assign(tempjpeg);
finally
tempstream.Free;
tempjpeg.Free;
end;
end;