Home > Back-end >  In the report (FastReport) dynamic load JPG photos, all the records are displayed when the preview i
In the report (FastReport) dynamic load JPG photos, all the records are displayed when the preview i

Time:09-30

Problem: such as the topic, the code is as follows:
The unit Unit1;

Interface

USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ADODB, DB, FR_DSet FR_DBSet, FR_Class, StdCtrls;

Type
TForm1=class (TForm)
For: TButton;
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
FrReport1: TfrReport;
FrDBDataSet1: TfrDBDataSet;
DataSource1: TDataSource;
ADOQuery1: TADOQuery;
Procedure Button1Click (Sender: TObject);
Procedure frReport1BeforePrint (Memo: TStringList; View: TfrView);

Private
{Private declarations} PV: TfrPictureView;
Procedure LoadPhoto;
Public
{Public declarations}
end;

Var
Form1: TForm1;

Implementation

{$R *. DFM}

Procedure TForm1. Button1Click (Sender: TObject);
The begin
FrReport1. LoadFromFile (' d: \ KWBM \ ZKZ. FRF);
PV:=(frReport1 FindObject (' Picture1) as TfrPictureView);
FrReport1. ShowReport;
end;
Procedure TForm1. LoadPhoto;
Var
S, FileName: String;
The begin
FileName:=trim (ADOTable1 FieldByName (' zp) AsString) are identical.

If FileExists (FileName) then
The begin
PV. Picture. LoadFromFile (FileName);
end;
end;
Procedure TForm1. FrReport1BeforePrint (Memo: TStringList; View: TfrView);
The begin
LoadPhoto
end;
end.

CodePudding user response:

PV:=(frReport1 FindObject (' Picture1) as TfrPictureView);

PV. Picture. LoadFromFile (FileName);

PV is to specify the name of a component, preview, of course, is loaded into the picture on this component

CodePudding user response:

The images stored in the database field in binary, image box to specify the field name
Can display images of each record

CodePudding user response:

Photos have randomness, and the data quantity is big, in the database, I store is the path of the photo, SELERON eldest brother, according to your reply for the first time, or all records show only the first record of photos, and there is no other way

CodePudding user response:

reference KJHWXM reply: 3/f
photos have randomness, and the data quantity is big, in the database, I store is the path of the photo, SELERON eldest brother, according to your reply for the first time, or all records show only the first record of photos, there is no other way to o


You specify the Pictrue1
to display the imageHow Pictrue1 show more pictures? A component can only display a picture

CodePudding user response:

Dynamically create multiple TfrPictureView
  • Related