Default image in ppDBImage
I would like to place a default JPEG image in a ppDBImage that is empty.
Where is a good place to do this. Of course, I would like to show this
default image in the print preview and also on the print out
(if the ppDBImage does not find a image in the database)
var
JPG: TJPEGImage;
begin
if (ppDBImage3.Picture.Graphic.Empty) and (gAlbumShowPlaceHolders) then
begin
Jpg := GetResourceAsJpeg('place_holder_obverse');
ppDBImage3.Picture.Bitmap.Assign(Jpg);
Jpg.Free;
end;
end;
Thanks
Where is a good place to do this. Of course, I would like to show this
default image in the print preview and also on the print out
(if the ppDBImage does not find a image in the database)
var
JPG: TJPEGImage;
begin
if (ppDBImage3.Picture.Graphic.Empty) and (gAlbumShowPlaceHolders) then
begin
Jpg := GetResourceAsJpeg('place_holder_obverse');
ppDBImage3.Picture.Bitmap.Assign(Jpg);
Jpg.Free;
end;
end;
Thanks
This discussion has been closed.
Comments
You can use the DBImage.OnGetPicture event. Here is a downloadable example
www.digital-metaphors.com/tips/UseDBImageOnGetPictureEvent.zip
Here is the event-handler code...
procedure TForm1.ppDBImage1GetPicture(Sender: TObject; aPicture: TPicture);
var
lPicture: TPicture;
begin
// call DataPipeline.GetFieldAsPicture method
lPicture := plBioLife.GetFieldAsPicture('Graphic');
if lPicture <> nil then
aPicture.Assign(lPicture)
else
aPicture.Assign(FDefaultPicture);
// for this example, replace the third image on each page
if ppReport1.DetailBand.Count = 3 then
aPicture.Assign(FDefaultPicture);
end;
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
i will try it now using the code below and see if it works
thanks