Смекни!
smekni.com

Создание базы данных "Wc3 Cybersport Data Base" (стр. 3 из 3)

SummaryBand2: TQRBand;

Title: TQRLabel;

Button2: TButton;

Button3: TButton;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure FormActivate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form2: TForm2;

LabelMassive : array[0..100] of TQRLabel;

TextMassive : array[0..100] of TQRDBText;

implementation

uses Unit1;

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);

begin

quickrep1.preview;

end;

procedure TForm2.Button2Click(Sender: TObject);

var

x,y,i:integer;

begin

Title.Caption:=Form1.Name;

// Buildind Report

Form1.MyQuery1.First;

for x:=0 to Form1.DBGrid1.Columns.Count-1 do begin

LabelMassive[x]:=TQRLabel.Create(form2);

LabelMassive[x].Parent:=Columnheaderband1;

LabelMassive[x].Font.Style:=[fsbold];

LabelMassive[x].Caption:=Form1.DBGrid1.Columns[x].FieldName;

LabelMassive[x].Top:=trunc(columnheaderband1.Height/2);

labelmassive[x].AutoSize:=false;

labelmassive[x].Width:=Form1.DBGrid1.Columns[x].Width;

// labelmassive[x].Frame.DrawRight:=true;

if x>0 then LabelMassive[x].Left:=trunc(quickrep1.Width/(Form1.DBGrid1.Columns.Count+1))+LabelMassive[x-1].Left+labelmassive[x-1].width-LabelMassive[x].Width

else LabelMassive[x].Left:=trunc(quickrep1.Width/(Form1.DBGrid1.Columns.Count+1))-LabelMassive[x].Width;

LabelMassive[x].Show;

end;

for x:=0 to Form1.DBGrid1.Columns.Count-1 do begin

TextMassive[x]:=TQRDBtext.Create(form2);

TextMassive[x].Parent:=Detailband1;

TextMassive[x].DataSet:=Form1.MyQuery1;

TextMassive[x].DataField:=Form1.DBGrid1.Columns[x].FieldName;

TextMassive[x].Top:=trunc(detailband1.Height/2);

Textmassive[x].AutoSize:=false;

Textmassive[x].Width:=Form1.DBGrid1.Columns[x].Width;

// textmassive[x].Frame.DrawRight:=true;

if x>0 then textMassive[x].Left:=trunc(quickrep1.Width/(Form1.DBGrid1.Columns.Count+1))+textMassive[x-1].Left+textmassive[x-1].width-textMassive[x].Width

else textMassive[x].Left:=trunc(quickrep1.Width/(Form1.DBGrid1.Columns.Count+1))-textMassive[x].Width;

textMassive[x].Show;

end;

end;

procedure TForm2.Button3Click(Sender: TObject);

var

x:integer;

begin

for x:=0 to Form1.DBGrid1.Columns.Count-1 do begin

labelmassive[x].Free;

textmassive[x].Free;

end;

form2.hide;

end;