参考:
http://bbs.csdn.net/topics/90119939
在 Picture1 之前 放 一个 memo
memo 的脚本 如下
begin
setp('Picture1','c:\1.jpg') ;
end
------------------------------------
加自定义函数 //你也可以加到 FR_Class 中去
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, FR_Class;
type
TForm1 = class(TForm)
frReport1: TfrReport;
procedure frReport1UserFunction(const Name: string; p1, p2,
p3: Variant; var Val: Variant);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.frReport1UserFunction(const Name: string; p1, p2,
p3: Variant; var Val: Variant);
var
pname, fn: string;
frView: TfrView;
begin
if SameText(Name, 'setp') then
begin
pname := frParser.Calc(p1);
fn := frParser.Calc(p2);
frView := frReport1.Pages[0].FindObject(pname);
if frView <> nil then
begin
TfrPictureView(frView).Picture.LoadFromFile(fn);
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
frReport1.ShowReport;
end;
end.
//fastreport 2.51 测试通过
在 Picture1 之前 放 一个 memo
memo 的脚本 如下
begin
setp('Picture1','c:\1.jpg') ;
end
------------------------------------
加自定义函数 //你也可以加到 FR_Class 中去
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, FR_Class;
type
TForm1 = class(TForm)
frReport1: TfrReport;
procedure frReport1UserFunction(const Name: string; p1, p2,
p3: Variant; var Val: Variant);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.frReport1UserFunction(const Name: string; p1, p2,
p3: Variant; var Val: Variant);
var
pname, fn: string;
frView: TfrView;
begin
if SameText(Name, 'setp') then
begin
pname := frParser.Calc(p1);
fn := frParser.Calc(p2);
frView := frReport1.Pages[0].FindObject(pname);
if frView <> nil then
begin
TfrPictureView(frView).Picture.LoadFromFile(fn);
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
frReport1.ShowReport;
end;
end.
//fastreport 2.51 测试通过