RB 10.04 JPEG Access Violation
Why does the following give me an access violation?
I have the ppJPEG unit included in my uses statement.
procedure TAdvertisingForm.rImage1Print(Sender: TObject);
begin
TppImage(Sender).Picture.LoadFromFile('c:\Test.jpg');
end;
Have also tried rImage.Picture.LoadFromFile('c:\Test.jpg');
Thanks,
Ken
I have the ppJPEG unit included in my uses statement.
procedure TAdvertisingForm.rImage1Print(Sender: TObject);
begin
TppImage(Sender).Picture.LoadFromFile('c:\Test.jpg');
end;
Have also tried rImage.Picture.LoadFromFile('c:\Test.jpg');
Thanks,
Ken
This discussion has been closed.
Comments
In my testing with your exact code below, I was able to successfully load a
Jpeg image into a TppImage object. Are you certain that Test.jpg is a valid
Jpeg file?
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Yes I am as I am already loading it into a TImage in my project.
Ken
Sorry. I had left a line of code in that shouldn't have been there.
LoadFromFile works fine.
What I am actually trying to do is the following and I get a "Bitmap is not
valid" error when it runs.
if not qAdvert.FieldByName('Image1').IsNull then
TppImage(Sender).Picture.Assign(qAdvert.FieldByName('Image1'));
qAdvert is a nexes Query. I need to load it like this as I eventually need
to do some manipulation of the image prior to loading it into the TppImage.
Ken
I believe the code you have below needs to be fired before the
TppImage.OnPrint event in order to function correctly. Also, be sure you
use the pipeline routines to get access to the field values manually. Try
something like the following...
procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
begin
ppImage1.Picture.Assign(ppReport1.DataPipeline.GetFieldAsPicture('Image'));
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com