将Delphi图像传递给FastReport
我想在FastReport中显示一个图像 以下是Delphi代码:将Delphi图像传递给FastReport,delphi,fastreport,Delphi,Fastreport,我想在FastReport中显示一个图像 以下是Delphi代码: img_sick.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Pictures/' + Qry_Search.FieldByName('code_personel').AsString + '.jpg'); 任何想法都将不胜感激 将图片对象放在报告窗体上。让我们假设它将被称为Picture1 在Delphi代码中,在要加载图片的方法中
img_sick.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) +
'Pictures/' + Qry_Search.FieldByName('code_personel').AsString + '.jpg');
任何想法都将不胜感激
Picture1
TfrxPictureView(YourReportObject.FindObject('Picture1')).Picture.LoadFromFile(…)
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;
Picture
属性是一个TPicture
,因此LoadFromFile
与您在示例中使用的方法相同。因此,只需提供相应的文件名作为参数Picture1
对象定义一个OnBeforePrint
处理程序,如下所示:
TfrxPictureView(YourReportObject.FindObject('Picture1')).Picture.LoadFromFile(…)
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;
打印前程序图片1(发送方:TFRX组件);
开始
TfrxPictureView(发件人).Picture.LoadFromFile(…);//引用
//到文件名表达式中的“code_personel”列
//在报告脚本的上下文中,视情况而定,
//也许是吧
结束;
据我所知,您的问题是“/”应该是反斜杠-->“\”正斜杠在API级别用于文件名操作。