楼上的有没有搞错? 是选择打印字段啊 我今天按照my_yc(海)的方法简单的做了一下procedure Tfrm_cxtjscbb.myrepBeforePrint(Sender: TCustomQuickRep; var PrintReport: Boolean); var i:integer; lb_top,lb_width,lb_space:integer; begin lb_top:=STOP; lb_width:=SWIDTH; lb_space:=SSPACE;//大写的是常量 with frm_rytj do begin For i:=0 to GroupBox1.ControlCount-1 do begin if groupbox1.Controls[i] is Tcheckbox then begin if (groupbox1.Controls[i] as Tcheckbox).Checked then begin with TQRlabel.Create(columnheaderband1) do begin tag:=i; parent:=columnheaderband1; font:=columnheaderband1.font; name:='lb'+inttostr(tag); caption:=Tcheckbox(groupbox1.Controls[i]).Caption; autosize:=true; top:=lb_top; left:=lb_space; end; with TQRDBtext.Create(detailband1) do begin tag:=i; parent:=detailband1; font:=detailband1.Font; name:='dt'+inttostr(tag); autosize:=true; autostretch:=true; top:=STOP; left:=lb_space+3; dataset:=adoquery1; datafield:=Tcheckbox(groupbox1.Controls[i]).Caption; end; lb_space:=lb_space+lb_width+SSPACE; end; end; end;end; if frm_rytj.adoquery1.recordcount<>0 then printreport:=true else printreport:=false;end; 但是不理想,根据选择字段多少的不同,排列不整齐,各位高手,怎么解决~~?
var PrintReport: Boolean);
var i:integer;
lb_top,lb_width,lb_space:integer;
begin
lb_top:=STOP;
lb_width:=SWIDTH;
lb_space:=SSPACE;//大写的是常量
with frm_rytj do
begin
For i:=0 to GroupBox1.ControlCount-1 do
begin
if groupbox1.Controls[i] is Tcheckbox then
begin
if (groupbox1.Controls[i] as Tcheckbox).Checked then
begin
with TQRlabel.Create(columnheaderband1) do
begin
tag:=i;
parent:=columnheaderband1;
font:=columnheaderband1.font;
name:='lb'+inttostr(tag);
caption:=Tcheckbox(groupbox1.Controls[i]).Caption;
autosize:=true;
top:=lb_top;
left:=lb_space;
end;
with TQRDBtext.Create(detailband1) do
begin
tag:=i;
parent:=detailband1;
font:=detailband1.Font;
name:='dt'+inttostr(tag);
autosize:=true;
autostretch:=true;
top:=STOP;
left:=lb_space+3;
dataset:=adoquery1;
datafield:=Tcheckbox(groupbox1.Controls[i]).Caption;
end;
lb_space:=lb_space+lb_width+SSPACE;
end;
end; end;end;
if frm_rytj.adoquery1.recordcount<>0 then
printreport:=true
else printreport:=false;end;
但是不理想,根据选择字段多少的不同,排列不整齐,各位高手,怎么解决~~?