预览中动态生成QRLabel和QRDBText,为什么运行后不显示?
代码如下:
procedure TForm1.PreparePrint();
var
LeftValue:integer;
aLabel : TQRLabel;
aText: TQRDBText;
SQL:string;
i:integer;
begin
i:=1;
LeftValue:=0;
with PrintF2 do
begin
aLabel := TQRLabel.Create(PrintF2);
//设置标题
aLabel.Parent := TitleBand1;
with aLabel do
begin
Width:=100;
Height:=TitleBand1.Height;
Alignment:=taCenter;
Caption :='工资汇总表';
Left :=312;
end;
DataModule1.tH_PayPrInfo.Open;
DataModule1.tH_PayPrInfo.First;
while not DataModule1.tH_PayPrInfo.EOF do
begin
aLabel := TQRLabel.Create(PrintF2);
//设置显示字段标题
aLabel.Parent :=ColumnHeaderBand1;
with aLabel do
begin
AutoSize:=False;
AutoStretch:=True;
Left :=LeftValue+42;
Top := 0;
Width:=50;
Height:=ColumnHeaderBand1.Height;
Alignment:=taCenter;
aLabel.Caption := DataModule1.tH_PayPrInfo.FieldbyName('H_Pname').AsString;
end;
SQL:='select * from manina where '
+ 'P_PayYM ='''+Cbo_PayYM2.Text+''''; SQL:=SQL + 'order by P_Code';
DataModule1.QueryP32.Close;
DataModule1.QueryP32.sql.Clear;
DataModule1.QueryP32.sql.text :=SQL; aText := TQRDBText.Create(PrintF2);
//设置显示字段内容
aText.Parent := DetailBand1;
with aText do
begin
AutoSize:=False;
AutoStretch:=True;
name:='aText'+IntToStr(i+10);
Left :=LeftValue+42;
Height:=DetailBand1.Height;
DataSet:=DataModule1.QueryP32;
DataField:=DataModule1.tH_PayPrInfo.FieldbyName('H_Pname').AsString;
Alignment:=taCenter;
end;
LeftValue:=LeftValue+37;
i:=i+1;
DataModule1.tH_PayPrInfo.Next; end;
end;
end;上面是一个过程,在Button1Click里调用,再加上PrintF2.QuickRep1.preview;
真不知道问题出在哪里555555555
先谢谢各位大虾~~~
代码如下:
procedure TForm1.PreparePrint();
var
LeftValue:integer;
aLabel : TQRLabel;
aText: TQRDBText;
SQL:string;
i:integer;
begin
i:=1;
LeftValue:=0;
with PrintF2 do
begin
aLabel := TQRLabel.Create(PrintF2);
//设置标题
aLabel.Parent := TitleBand1;
with aLabel do
begin
Width:=100;
Height:=TitleBand1.Height;
Alignment:=taCenter;
Caption :='工资汇总表';
Left :=312;
end;
DataModule1.tH_PayPrInfo.Open;
DataModule1.tH_PayPrInfo.First;
while not DataModule1.tH_PayPrInfo.EOF do
begin
aLabel := TQRLabel.Create(PrintF2);
//设置显示字段标题
aLabel.Parent :=ColumnHeaderBand1;
with aLabel do
begin
AutoSize:=False;
AutoStretch:=True;
Left :=LeftValue+42;
Top := 0;
Width:=50;
Height:=ColumnHeaderBand1.Height;
Alignment:=taCenter;
aLabel.Caption := DataModule1.tH_PayPrInfo.FieldbyName('H_Pname').AsString;
end;
SQL:='select * from manina where '
+ 'P_PayYM ='''+Cbo_PayYM2.Text+''''; SQL:=SQL + 'order by P_Code';
DataModule1.QueryP32.Close;
DataModule1.QueryP32.sql.Clear;
DataModule1.QueryP32.sql.text :=SQL; aText := TQRDBText.Create(PrintF2);
//设置显示字段内容
aText.Parent := DetailBand1;
with aText do
begin
AutoSize:=False;
AutoStretch:=True;
name:='aText'+IntToStr(i+10);
Left :=LeftValue+42;
Height:=DetailBand1.Height;
DataSet:=DataModule1.QueryP32;
DataField:=DataModule1.tH_PayPrInfo.FieldbyName('H_Pname').AsString;
Alignment:=taCenter;
end;
LeftValue:=LeftValue+37;
i:=i+1;
DataModule1.tH_PayPrInfo.Next; end;
end;
end;上面是一个过程,在Button1Click里调用,再加上PrintF2.QuickRep1.preview;
真不知道问题出在哪里555555555
先谢谢各位大虾~~~
解决方案 »
- 用GraphicEx将Bmp转PNG,转出后还是BMP格式.不知如何写?请帮忙
- 有关大量用户在经的服务器的问题
- 如何由自己的程序向用友的程序界面中的Edit中写东西?
- 备份的请求!
- 当formload执行的时候,消息触发了
- 谁有网吧管理系统合作?
- 怎样判断一个TStringList类变量还没有被赋值或已经被free ?
- 又急:当客户选中dbcombobox中某一个item时,要使他的选中无效,dbcombobox的text不变,怎么办?
- 怎样在combobox中加入图片?
- 一个记录对象(type RMyRecord = record) 似乎不需要实例化?
- 关于lxpbuaa的《delphi精要》一书的小问题
- delphi下怎么调用java的函数呢?
我在程序里.已写了.
qrlabel1.caption:=kk;//kk是一个String的变量
运行时qrlabe1显示不出来.