function SelectwhColumn(a :integer):string;// 该函数使0~4五个数字匹配表里的五个字段名
begin
case a of
0 :Result := 'sj';
1 :Result := 'gzxx';
2 :Result := 'xcazwxjl';
3 :Result := 'cljg';
4 :Result := 'azwhr';
else
Result := '';
end;
end;
//..................代码生成的QRTLabel赋值,使其等于表里的各个字段值..........//
for i := 0 to 4 do
with TQRLabel.Create(Form2.DetailBand1) do
begin
Parent := Form2.DetailBand1;
Tag := 10;
Top := LabTop+43;
Left := whLabLeft[i];
Width := whLabWidth[i];
WordWrap := true;
AutoSize:=false;
AutoStretch := true; //试过为false也不行
Alignment := taCenter;
Transparent := true;
{ adoquery7.Close;
adoquery7.SQL.Text := 'select * from azwhjl where txzh = '+#39+DBE_zh1.Text+#39;
adoquery7.Open;
ws := Adoquery7.FieldByName(SelectwhColumn(j)).AsString;//使用注释掉的部分,还是不行,提示读不到fieldbyname为''的值
if length(ws) > 8 then
for j := 1 to length(ws) do
begin
nws := nws + ws[j];
if j = 8 then
nws := nws + #13;
end;
Caption := nws; }
Caption := Adoquery7.FieldByName(SelectwhColumn(i)).AsString;
Visible := true;
end;以上是我一点代码,还是老问题,我想实现QRLabel的自动换行,请问该怎么做,网上找的方法都试过了,都没什么作用,请大家多帮帮忙。。谢谢!
begin
case a of
0 :Result := 'sj';
1 :Result := 'gzxx';
2 :Result := 'xcazwxjl';
3 :Result := 'cljg';
4 :Result := 'azwhr';
else
Result := '';
end;
end;
//..................代码生成的QRTLabel赋值,使其等于表里的各个字段值..........//
for i := 0 to 4 do
with TQRLabel.Create(Form2.DetailBand1) do
begin
Parent := Form2.DetailBand1;
Tag := 10;
Top := LabTop+43;
Left := whLabLeft[i];
Width := whLabWidth[i];
WordWrap := true;
AutoSize:=false;
AutoStretch := true; //试过为false也不行
Alignment := taCenter;
Transparent := true;
{ adoquery7.Close;
adoquery7.SQL.Text := 'select * from azwhjl where txzh = '+#39+DBE_zh1.Text+#39;
adoquery7.Open;
ws := Adoquery7.FieldByName(SelectwhColumn(j)).AsString;//使用注释掉的部分,还是不行,提示读不到fieldbyname为''的值
if length(ws) > 8 then
for j := 1 to length(ws) do
begin
nws := nws + ws[j];
if j = 8 then
nws := nws + #13;
end;
Caption := nws; }
Caption := Adoquery7.FieldByName(SelectwhColumn(i)).AsString;
Visible := true;
end;以上是我一点代码,还是老问题,我想实现QRLabel的自动换行,请问该怎么做,网上找的方法都试过了,都没什么作用,请大家多帮帮忙。。谢谢!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货