delphi字符串固定长度换行

Posted semth

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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;
 
........................

以上是关于delphi字符串固定长度换行的主要内容,如果未能解决你的问题,请参考以下文章