delphi字符串固定长度换行

var
  str,capstr:string;
  i,j:integer;
 
....................
j:=500;   //这个地方可能要根据你显示的宽度来换算对应的字符长度
str:=somestring;
capstr:=''
i:=1
while i<=length(somestring) do
begin
  capstr:=capstr+copy(str,i,j)+#13#10;
  i:=i+j;
end;
 
label1.WordWrap:=true;
label1.AutoSize:=true;
label1.Font.Name:='宋体';
label1.Caption:=capstr;
 
........................
posted @ 2019-04-24 17:13  快乐的正能量  阅读(1209)  评论(0编辑  收藏  举报