繁体   English   中英

将Delphi图像传递给FastReport

[英]Pass Delphi image to FastReport

我想在FastReport中显示一个图像。

这是Delphi代码:

 img_sick.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) +
      'Pictures/' +  Qry_Search.FieldByName('code_personel').AsString + '.jpg');

任何想法,将不胜感激。

  1. 将图片对象放在报表上。 我们假设它将被称为Picture1

  2. 在Delphi代码中,在要加载图片的方法中,添加如下所示的行:

     TfrxPictureView(YourReportObject.FindObject('Picture1')).Picture.LoadFromFile(…) 

    Picture属性是一个TPicture ,因此LoadFromFile与您在示例中使用的方法相同。 因此,只需提供相应的文件名作为参数。

这应该运行报告之前完成。 如果要运行报表的过程中加载图片,则应该尝试在报表脚本中执行类似的操作。 也许我会为Picture1对象定义一个OnBeforePrint处理程序,如下所示:

procedure Picture1OnBeforePrint(Sender: TfrxComponent);
begin
  TfrxPictureView(Sender).Picture.LoadFromFile(…);  // use a reference
          // to the "code_personel" column in the file name expression
          // as appropriate in the context of the report script,
          // like <Qry_Search."code_personel">, perhaps
end;

你的问题是“/”它应该是一个反斜杠--->“\\”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM