我用QuickReport 做的报表,其中有一栏“缴费信息”,需要将各个缴费项目(最多5个,我用了5个dbtext:item1,item2,item3,item4,item5;并且每条记录的缴费项目数不定)按顺序排列在这一栏里。因此需要在程序里动态设定它们的位置。我是这样设定的:
try
application.CreateForm(Tfrmdetailqryprev,frmdetailqryprev);
with frmdetailqryprev do
begin
for i:=1 to table1.recordcount do //table1是QuickRep连接的DataSet
begin
item1.Left:=180;
item2.Left:=item1.Left+trunc(item1.Size.Width)+8;
item3.Left:=item2.Left+trunc(item2.Size.Width)+8;
item4.Left:=item3.Left+trunc(item3.Size.Width)+8;
item5.Left:=item4.Left+trunc(item4.Size.Width)+8;
table1.Next;
end;
end;
frmdetailqryprev.QuickRep1.Preview;
except
on EAccessViolation do
begin
frmdetailqryprev.free;
end;
end; 可程序运行时,几个item的排列间隔却很近,没有达到预期目的,这是什么原因?
try
application.CreateForm(Tfrmdetailqryprev,frmdetailqryprev);
with frmdetailqryprev do
begin
for i:=1 to table1.recordcount do //table1是QuickRep连接的DataSet
begin
item1.Left:=180;
item2.Left:=item1.Left+trunc(item1.Size.Width)+8;
item3.Left:=item2.Left+trunc(item2.Size.Width)+8;
item4.Left:=item3.Left+trunc(item3.Size.Width)+8;
item5.Left:=item4.Left+trunc(item4.Size.Width)+8;
table1.Next;
end;
end;
frmdetailqryprev.QuickRep1.Preview;
except
on EAccessViolation do
begin
frmdetailqryprev.free;
end;
end; 可程序运行时,几个item的排列间隔却很近,没有达到预期目的,这是什么原因?
解决方案 »
- DELPHI怎么设置老板键?
- 关于将wav文件做到exe文件中的问题
- 请问各位兄弟,到哪里申请免费空间好点?
- 怎样建立一棵任意树?
- 怎样打印dbgrid中的内容(并支持分页打印)?(有百分送,不够可再加)
- 为什么我在D5下写的小程序拷贝到D6的PROJECTS下后,只要用D6试图打开它,D6就自动关闭?
- 菜鸟问题 在线等待!
- 谁能清晰地解释下面几个概念?
- 急急急!!!关于dephi MD5和base64加密问题
- 冠以可视化继承的问题?
- 开发进销存:单据录入,DELPHI用什么解决比较好?不知道速达3000XP中的入库单单据录入是用什么做的?
- Delphi如何对SQLSERVER 2000中的数据库进行维护(备份和恢复)
item1.Left:=180;
item2.Left:=item1.Left+trunc(item1.Size.Width)+8;
item3.Left:=item2.Left+trunc(item2.Size.Width)+8;
item4.Left:=item3.Left+trunc(item3.Size.Width)+8;
item5.Left:=item4.Left+trunc(item4.Size.Width)+8;
调整left属性的语句写在相应band的onshow事件内。
(具体事件的名称记不清楚,大概是这样的)
正如你说所的那样,我是把几个item的AUTOSIZE属性设成TRUE。TO ScoutKing:
BAND没有onshow事件,我正尝试放在BEFOREPRINT 中试试
procedure Tfrmdetailqryprev.QRBand4BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
item1.Left:=168;
item2.Left:=item1.Left+item1.Width+8;
item3.Left:=item2.Left+item2.Width+8;
item4.Left:=item3.Left+item3.Width+8;
item5.Left:=item4.Left+item4.Width+8;
end;
可还是不行,各位高手,该怎么改呢