开发者

Creating TQReport elements at run time

开发者 https://www.devze.com 2023-03-14 21:47 出处:网络
Creating TQReport elements at run time. Well, at least trying... I don\'t know what headings or data shall appear on this report. I get a TList of TStrings representing the data rows and columns. I

Creating TQReport elements at run time.

Well, at least trying...

I don't know what headings or data shall appear on this report. I get a TList of TStrings representing the data rows and columns. I plant the 'Create' dire开发者_如何学JAVActives in the band print event for the group and the OnNeedData event for main data row bands. But nothing appears. Must I make the labels at design time? Do not want.


To get you started, this works:

// uses QuickRpt, qrpBaseCtrls, QRCtrls, QRPrntr;

procedure TForm1.Button1Click(Sender: TObject);
var QR: TQuickRep;
    QB: TQRBand;
    QL: TQRLabel;
begin
  QR := TQuickRep.Create(Self);
  try
    QR.PrintIfEmpty := True;

    QB := TQRBand.Create(Self);
    QB.Parent := QR;
    QB.BandType := rbTitle;

    QL := TQRLabel.Create(Self);
    QL.Parent := QB;
    QL.Left := 10;
    QL.Top := 10;
    QL.AutoSize := True;
    QL.Caption := 'This works';

    QR.Preview;

  finally QR.Free;
  end;
end;
0

精彩评论

暂无评论...
验证码 换一张
取 消