Image - LoadFromStream problem
Hi,
RB 14.08 with Delphi 2010
I use the onPrint event of a TppImage control to load an image from a
database for each record.
This is my code:
procedure TExportForm.ppImageScanPagePrint(Sender: TObject);
var
MyStream: TMemoryStream;
begin
MyStream := TMemoryStream.Create;
try
ScansTableBinary.SaveToStream(MyStream);
MyStream.Position := 0;
ppImageScanPage.Picture.Graphic.LoadFromStream(MyStream);
finally
MyStream.Free;
end;
end;
Generally that works fine, but the printed image is the same (1st one)
for all records. I checked the MemoryStream: it's different as expected.
Is there any kind of "reset" necessary to force the image component to
load the graphic from the stream?
Thanks and regards
Uli
RB 14.08 with Delphi 2010
I use the onPrint event of a TppImage control to load an image from a
database for each record.
This is my code:
procedure TExportForm.ppImageScanPagePrint(Sender: TObject);
var
MyStream: TMemoryStream;
begin
MyStream := TMemoryStream.Create;
try
ScansTableBinary.SaveToStream(MyStream);
MyStream.Position := 0;
ppImageScanPage.Picture.Graphic.LoadFromStream(MyStream);
finally
MyStream.Free;
end;
end;
Generally that works fine, but the printed image is the same (1st one)
for all records. I checked the MemoryStream: it's different as expected.
Is there any kind of "reset" necessary to force the image component to
load the graphic from the stream?
Thanks and regards
Uli
This discussion has been closed.
Comments
Is there a reason you're not using TppDBImage?
Try loading the stream into a local lGraphic and assign it to the
Picture.Graphic like this..
lGraphic := TJpegImage.Create;
lGraphic.LoadFromStream(lStream);
ppImage.Picture.Graphic := lGraphic
lGraphic.Free;
If you still have an issue, please provide a simple example project that I
can build and run in the debugger. Please use standard Delphi components and
RB. Copy the data to TClientDataSets. Send in zip format - include only
.dpr, .pas, .dfm. Send to support@
Best regards,
-
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Yes, the images in my database are .tif and .jpeg images from a scanner.
TppDBImage doesn't load the .tif images.
Since I don't know the type of the image, I can't use that, or is there
another way?
Thanks and regards Uli
any idea on that?
Thanks Uli