FrPicture load with Data from Value

Hello,
I am using Fr2.51

and I want to put the PictureData from a Value,

and in OnGetValue-Event I want to load
the the Value (Variant) from a TMemoryStream.(Bmp)


.... OnGetValue(..)

begin
if ParName = 'PIC1' then
begin
ParValue := ?



end;
(can I uses a String, which I load with the Picture-Data?)

(SetLength(AStr,MyMemStream.Size);
MemStream.ReadBuffer(AStr,MemStream.Size);
or may I use Dynamic Arrays?
)



regards
Ibego

(When I use a Blobfield it works fine, but in this case I cant use a Table)

Comments

  • edited 6:41AM
    You can use TFRPictureView.Picture's LoadFromFile, LoadFromStream methods if the stream is a memory bitmap. If You load the graphic data from any other image format not directly supported by the VCL, You must assign the loaded data to a TBitmap instance and then assign that bitmap to the PictureView's Picture object. Let me clear:

    procedure TForm1.RBeforePrint(Memo: TStringList; View: TfrView);
    Var JPeg:TJpegImage;
    Bm:TBitmap;
    Pv:TFRPictureView;
    begin
    If View.Name='Picture1' then
    Begin
    JPeg:=TJPEGImage.Create;
    JPeg.LoadFromFile('c:\1.jpg');
    Bm:=TBitmap.Create;
    Bm.Assign(JPeg);
    TFRPictureView(View).Picture.Bitmap.Assign(Bm);

    Bm.Free;
    JPeg.Free;
    End;
    end;

    Of course if You use native bitmaps the steps behind the loading and the final assigning can be missed or You can use the TFRPictureView(View).Picture.LoadFromFile LoadFromStream as mentioned above.

    I hope this helps.

    Regards:Alex
  • edited 6:41AM
    Thank You, Alex.

    Is it only in the BeforePrint-Event possible to assign a Picture?

    I would prefer OnGetValue, because I can change the Report at Runtime,

    When I use BeforePrint then I need to Know the Name of the FrView-Object,
    and I cannot insert two more in the Report.

    When I have a Variable which is filled in OnGetValue then I can decide in the Report how much I show the Picture.


    bestregards

    Ibego
  • gordkgordk St.Catherines On. Canada.
    edited 6:41AM
    Hi Ibego
    "When I use BeforePrint then I need to Know the Name of the FrView-Object,
    and I cannot insert two more in the Report.", only when working externally.
    Try working from the script of the pictureview objects memo to do your actual loading or assigning, and you may want to write an on userfunction handler(s) for the report to pass out up to 3 params and return 1 result value, there is a lot of possible combinations you can work out.
    regards ;)
  • edited 6:41AM
    Thanks,

    this is a good idea! I will try it.

    regards
    Ibego

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.