OnBeforePrint alternate

edited 11:44PM in FastReport 4.0
Hello,
I wanna write a delphi component that takes a picture form a source and assign it to frxPictureview control. Offcouse I can do this in Report.OnBeforePrint event. But I can not use this event for some reasons. I can find picture control using Report1.FindObject() but I need an event similar to OnBeforePrint or an alternate technique through which I could avoid OnBeforePrint event and assign picture before report window opens. Is it possible and how?
thanks in advance,

Regards
MS Pathan

Comments

  • Anu de DeusAnu de Deus Hampshire, UK
    edited 11:44PM
    You can do it by code, before calling prepare or show report.
    You need to load your report into a local TFRXreport object, then find the tfrxpicture object in the objectlist, and assign its properties.
    I have something like this:

    (lPic is currently pointing to the TfrxPictureView object in the report)
              lTmpPic := TfrxPictureView.Create(nil);
                lTmpPic.AutoSize := lPic.AutoSize;
                lTmpPic.Top := lPic.Top;
                lTmpPic.left := lPic.left;
                lTmpPic.width := lPic.width;
                lTmpPic.height := lPic.height;
                lTmpPic.Stretched := lPic.Stretched;
                lTmpPic.Align  := lPic.Align;
                lTmpPic.Center := lPic.Center;
                lTmpPic.KeepAspectRatio := lPic.KeepAspectRatio;
    
                lTmpPic.LoadPictureFromStream(pChapter.fItems.Objects[i].GetStream); // pChapter is my own object, not frx
    
                lPic.Assign(lTmpPic); <<<<< THIS IS WHAT YOU ULTMIMATELY NEED
    
                lTmpPic.Free;
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.