好的!
主要是改动了这个函数:
procedure WrapLine(const s: String);
var
i, cur, beg, last, LoopPos: Integer;
WasBreak, CRLF: Boolean;
begin
CRLF := False;
LoopPos := 0;
for i := 1 to Length(s)do
if s in [#10, #13] then
begin
CRLF := True;
break;
end;
last := 1;
beg := 1;
if not CRLF and ((Length(s) <= 1) or (WCanvas.TextWidth(s) <= maxwidth)) then
OutLine(s + #1)
else
begin
cur := 1;
while cur <= Length(s)do
begin
if s[cur] in [#10, #13] then
begin
OutLine(Copy(s, beg, cur - beg) + #1);
while (cur < Length(s)) and (s[cur] in [#10, #13])do
Inc(cur);
beg := cur;
last := beg;
if s[cur] in [#13, #10] then
Exit else
continue;
end;
if s[cur] <> ' ' then
if WCanvas.TextWidth(Copy(s, beg, cur - beg + 1)) > maxwidth then
begin
WasBreak := False;
if (Flags and flWordBreak) <> 0 then
begin
i := cur;
while (i <= Length(s)) and not (s in spaces)do
Inc(i);
b := BreakWord(Copy(s, last + 1, i - last - 1));
if Length(b) > 0 then
begin
i := 1;
cur := last;
while (i <= Length(b)) and (WCanvas.TextWidth(Copy(s, beg, last - beg + 1 + Ord(b)) ) <= maxwidth)do
begin
WasBreak := True;
cur := last + Ord(b);
Inc(i);
end;
last := cur;
end;
end
else
if last = beg then
last := cur;
if WasBreak then
begin
if ByteType(s,last) = mbLeadByte then
//Tian 2001.03
begin
OutLine(Copy(s, beg, last - beg ));
end
else
If ByteType(s,last) = mbSingleByte then
begin
OutLine(Copy(s, beg, last - beg + 1));
end
else
If ByteType(s,last) =mbTrailByte then
begin
OutLine(Copy(s, beg, last - beg +1));
end;
end
else
if s[last] = ' ' then
OutLine(Copy(s, beg, last - beg))
else
OutLine(Copy(s, beg, last - beg + 1));
if ((Flags and flWordBreak) <> 0) and not WasBreak and (last = cur) then
if LoopPos = cur then
begin
beg := cur + 1;
cur := Length(s);
break;
end
else
LoopPos := cur;
if ByteType(s,last) = mbLeadByte then
//Tian 2001.03
begin
beg := last ;
last := beg;
end
else
If ByteType(s,last) = mbSingleByte then
begin
beg := last + 1;
last := beg;
end
else
If ByteType(s,last) =mbTrailByte then
begin
beg := last+1 ;
last := beg;
end;
end;
if s[cur] = ' ' then
last := cur;
Inc(cur);
end;
if beg <> cur then
OutLine(Copy(s, beg, cur - beg + 1) + #1);
end;
end;
其实我也不是想敲诈大家,只因小第刚来不久,想找点分好防身!