在运行时创建子带 Delphi (QR)
我有以下代码,
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 技术交流群。

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