Recent

Author Topic: How to pass TImage to LazReport ?  (Read 2679 times)

FrankBKK

  • New Member
  • *
  • Posts: 23
How to pass TImage to LazReport ?
« on: June 24, 2021, 03:36:36 pm »
How can I pass dynamically generated Images to LazReport ?

Is there a way similar as to pass a variable ?

HB9FIH

  • New member
  • *
  • Posts: 6
Re: How to pass TImage to LazReport ?
« Reply #1 on: July 15, 2022, 02:00:54 pm »
Frank - problem solved ?
here my code: - I still looking for pass an Image ... but no success until now..maybe you solved

procedure TForm1.frReport1GetValue(const ParName: String; var ParValue: Variant
  );
var
  i: Integer;
begin
  for i:=0 to ComponentCount-1 do
  begin
    if UpperCase(ParName)=UpperCase(Components.Name) then
    begin
//    showmessage(inttostr(i)+ParName);
      case Components.ClassName of
      'TEdit': ParValue:=(Components as TEdit).Text;
      'TComboBox': ParValue:=(Components as TComboBox).Text;
      'TLabel': ParValue:=(Components as TLabel).Caption;
      'TButton': ParValue:=(Components as TButton).Caption;
      'TMemo': ParValue:=(Components as TMemo).Lines.Text;
  //    'TImage': ParValue:= Components Image1.Picture;
//      'TSpinEdit': ParValue:=(Components as TSpinEdit).Value;
//      'TFloatSpinEdit': ParValue:=(Components as TFloatSpinEdit).Value;
      end;
    end;
  end;

end;

dseligo

  • Hero Member
  • *****
  • Posts: 813
Re: How to pass TImage to LazReport ?
« Reply #2 on: July 15, 2022, 05:14:10 pm »
here my code: - I still looking for pass an Image ... but no success until now..maybe you solved

You can load images in OnEnterRect event.

Try this code:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.frReport1EnterRect(Memo: TStringList; View: TfrView);
  2. begin
  3.   If View.Name = 'Picture1' then
  4.       (View as TfrPictureView).Picture.LoadFromFile('mypic001.bmp');
  5. end;

Of course, your picture name has to be 'Picture1' (or change name in the code), and you have to put image file 'mypic001.bmp' with executable file.

 

TinyPortal © 2005-2018