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;
 
........................
相關文章
相關標籤/搜索