你的lines是load进去的吧,用下面的函数转换一下。 procedure tform1.transfer; var buf:string; pos:word; begin with richedit1 do begin buf:=Text; pos:=1; while pos<length(buf) do begin if ord(buf[pos])>=127 then begin SelStart:=pos-1; SelLength:=2; selattributes.charset:=GB2312_CHARSET; pos:=pos+2; end else pos:=pos+1; end; end; end;
procedure tform1.transfer;
var
buf:string;
pos:word;
begin
with richedit1 do
begin
buf:=Text;
pos:=1;
while pos<length(buf) do
begin
if ord(buf[pos])>=127 then
begin
SelStart:=pos-1;
SelLength:=2;
selattributes.charset:=GB2312_CHARSET;
pos:=pos+2;
end
else
pos:=pos+1;
end;
end;
end;