我使用了一段网上提供得程序,是通过加空格方式来控制折行的,但是汉字还是没有方法处理成功,仍然会出现乱码。help!!AutoSize := false;
AutoStretch := true;
WordWrap := true;==========================
以下程序写在QRDBtext的OnPrint事件中 tm := 6;
if (length(Value)*tm)<= TQRDBText(sender).Width then exit; strSource := Value;
Value :=''; //防止截断汉字。
while true do
begin
iLen := 1; while (iLen*tm) < TQRDBText(sender).Width do
begin
if (ord(strSource[iLen])>128) or (ord(strSource[iLen])<0) then
iLen := ilen + 2
else
inc(iLen);
end; DEC(iLen); strTemp := leftstr(strSource,iLen);
//加回车。
if (Value='') then
Value := strTemp
else
Value := Value + ' ' + strTemp; strSource := midstr(strSource,iLen + 1, Length(strSource) - iLen);
if Length(strSource)*tm <= TQRDBText(sender).Width then
begin
Value := Value + ' '+ strSource;
break;
end;
end;
AutoStretch := true;
WordWrap := true;==========================
以下程序写在QRDBtext的OnPrint事件中 tm := 6;
if (length(Value)*tm)<= TQRDBText(sender).Width then exit; strSource := Value;
Value :=''; //防止截断汉字。
while true do
begin
iLen := 1; while (iLen*tm) < TQRDBText(sender).Width do
begin
if (ord(strSource[iLen])>128) or (ord(strSource[iLen])<0) then
iLen := ilen + 2
else
inc(iLen);
end; DEC(iLen); strTemp := leftstr(strSource,iLen);
//加回车。
if (Value='') then
Value := strTemp
else
Value := Value + ' ' + strTemp; strSource := midstr(strSource,iLen + 1, Length(strSource) - iLen);
if Length(strSource)*tm <= TQRDBText(sender).Width then
begin
Value := Value + ' '+ strSource;
break;
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货