procedure TForm1.Button2Click(Sender: TObject);
var
i:Integer;
begin
with ADOTable1 do
begin
First;
for i:=0 to RecordCount - 1 do
begin
LoadPhoto;
Next;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
PV:=(frReport1.FindObject('Picture1') as TfrPictureView);
frReport1.ShowReport;
end;
procedure TForm1.LoadPhoto;
var
S,FileName:String;
begin
S:= trim(ADOTable1.FieldByName('EmpNo').AsString);
FileName:='C:\Documents and Settings\Administrator\My Documents\My Pictures\'
+ S +'.jpg';
if FileExists(FileName) then
begin
PV.Picture.LoadFromFile(FileName);
end;
end;
procedure TForm1.frReport1BeforePrint(Memo: TStringList; View: TfrView);
begin
LoadPhoto;
end;
procedure TForm1.Button1Click(Sender: TObject);
var FRName,JpgPath:string;
t1:TfrPictureView;
begin
FRName:='c:\myfr.frf';
JpgPath:='c:\1.jpg';//你可以把数据库中保存的文件路径赋值给JpgPath
frReport1.LoadFromFile(FRName);
t1:=TfrPictureView(frReport1.FindObject('Picture1'));//这两句实现动态载入照片,Picture1是你报表中显示照片的frPictureView控件名字。
if t1<>nil then t1.Picture.LoadFromFile(JpgPath);