在运行时创建子带 Delphi (QR)

发布于 01-09 20:35 字数 794 浏览 2 评论 0原文

我有以下代码,

procedure Tar_ardemo.qr_ardemoBeforePrint(Sender: TCustomQuickRep;
  var PrintReport: Boolean);
var
    QR: TquickRep;
    QB2: TQRBand;
    QB3: TQRChildBand;
    QL: TQRLabel;
begin
  with artikste do
  begin
    close;
    sql.Clear;
    sql.add('SELECT * FROM Artikels');
    open;
    first;
  end;

  QR := qr_ardemo;
  QB2 := QRBAND2;
  QB3 := TQRchildband.Create(QR);
  QB3.ParentBand := QB2;
  QB3.Height := 40;

  QL := TQRLabel.Create(QR);
  QL.Parent := QB3;
  QL.Left := 300;
  QL.Top := 1;
  QL.Width := 81;
  QL.Height := 23;
  QL.Caption := 'QRLabeZZ';
end;

我想在运行时创建一个 Childband (QB3) 和一个 QRLabel (QL)。当我在 Delphi 中运行脚本时,我只是在输出中看不到它。当我将 QL.Parent := QB3 更改为 QB2 时,我在 QRBand2 中看到输出,但我想在刚刚创建的 Childband QB3 中看到它。我有什么错吗?我想不通。

谢谢

I have the following code

procedure Tar_ardemo.qr_ardemoBeforePrint(Sender: TCustomQuickRep;
  var PrintReport: Boolean);
var
    QR: TquickRep;
    QB2: TQRBand;
    QB3: TQRChildBand;
    QL: TQRLabel;
begin
  with artikste do
  begin
    close;
    sql.Clear;
    sql.add('SELECT * FROM Artikels');
    open;
    first;
  end;

  QR := qr_ardemo;
  QB2 := QRBAND2;
  QB3 := TQRchildband.Create(QR);
  QB3.ParentBand := QB2;
  QB3.Height := 40;

  QL := TQRLabel.Create(QR);
  QL.Parent := QB3;
  QL.Left := 300;
  QL.Top := 1;
  QL.Width := 81;
  QL.Height := 23;
  QL.Caption := 'QRLabeZZ';
end;

I want to create a Childband (QB3) and a QRLabel (QL) at runtime. I just can't see it in my output, when I run the script in Delphi. When I change QL.Parent := QB3 to QB2, I see the output in QRBand2, but I want to see it in the just created Childband QB3. What do I wrong? I can not figure it out.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

童话2025-01-16 20:35:46

这可能是一个解决方案:

procedure Tar_ardemo.qr_ardemoBeforePrint(Sender: TCustomQuickRep;
  var PrintReport: Boolean);
var
    QR: TquickRep;
    QB2: TQRBand;
    QB3: TQRChildBand;
    QL: TQRLabel;
    QS : string;
begin
  with artikste do
  begin
    close;
    sql.Clear;
    sql.add('SELECT * FROM Artikels');
    open;
    first;
  end;

  QR := QR_ARDEMO;
  QB2 := QRBAND2;

  QB2.HasChild := true;
  QB2.ChildBand.Height := 23;
  QL := TQRLabel.Create(QR);
  QL.Parent := QB2.ChildBand;
  QL.Left := 100;
  QL.Top := 1;
  QL.Width := 81;
  QL.Height := 23;
  QL.Caption := 'QRLabeXX';

  QB2.ChildBand.HasChild := true;
  QB2.ChildBand.ChildBand.Height := 23;
  QL := TQRLabel.Create(QR);
  QL.Parent := QB2.ChildBand.ChildBand;
  QL.Left := 100;
  QL.Top := 1;
  QL.Width := 81;
  QL.Height := 23;
  QL.Caption := 'QRLabeYY';

  QB2.ChildBand.ChildBand.HasChild := true;
  QB2.ChildBand.ChildBand.ChildBand.Height := 23;
  QL := TQRLabel.Create(QR);
  QL.Parent := QB2.ChildBand.ChildBand.ChildBand;
  QL.Left := 100;
  QL.Top := 1;
  QL.Width := 81;
  QL.Height := 23;
  QL.Caption := 'QRLabeZZ';
end;

end.

这有效(huray)。但现在的问题是:如何获取childband.chhildband......childband的数组。没有像 Childband[x] 这样的 Childband 数组。或者说有一个吗??正如我所写,可能有很多 Childbands [n]。它必须是动态的,并且......在打印第一个子带之后,必须在打印下一个记录的下一个子带之前销毁它们(Artikel)。

This could be a solution:

procedure Tar_ardemo.qr_ardemoBeforePrint(Sender: TCustomQuickRep;
  var PrintReport: Boolean);
var
    QR: TquickRep;
    QB2: TQRBand;
    QB3: TQRChildBand;
    QL: TQRLabel;
    QS : string;
begin
  with artikste do
  begin
    close;
    sql.Clear;
    sql.add('SELECT * FROM Artikels');
    open;
    first;
  end;

  QR := QR_ARDEMO;
  QB2 := QRBAND2;

  QB2.HasChild := true;
  QB2.ChildBand.Height := 23;
  QL := TQRLabel.Create(QR);
  QL.Parent := QB2.ChildBand;
  QL.Left := 100;
  QL.Top := 1;
  QL.Width := 81;
  QL.Height := 23;
  QL.Caption := 'QRLabeXX';

  QB2.ChildBand.HasChild := true;
  QB2.ChildBand.ChildBand.Height := 23;
  QL := TQRLabel.Create(QR);
  QL.Parent := QB2.ChildBand.ChildBand;
  QL.Left := 100;
  QL.Top := 1;
  QL.Width := 81;
  QL.Height := 23;
  QL.Caption := 'QRLabeYY';

  QB2.ChildBand.ChildBand.HasChild := true;
  QB2.ChildBand.ChildBand.ChildBand.Height := 23;
  QL := TQRLabel.Create(QR);
  QL.Parent := QB2.ChildBand.ChildBand.ChildBand;
  QL.Left := 100;
  QL.Top := 1;
  QL.Width := 81;
  QL.Height := 23;
  QL.Caption := 'QRLabeZZ';
end;

end.

This works (huray). But now the problem is: How do I get an array of childband.chhildband......childband. There is no Childband array like Childband[x]. Or is there one?? As I wrote there could be many Childbands [n]. It has to be dynamic, and... after printing the first childbands, they must be destroyed, before printing the next childbands for the next record (Artikel).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文