function TRxCustomRichEdit.GetTextRange(StartPos, EndPos: Longint): string;
var
TextRange: TTextRange;
begin
// SetLength(Result, EndPos - StartPos + 1);
SetLength(Result, (EndPos - StartPos) * 2 + 1);
TextRange.chrg.cpMin := StartPos;
TextRange.chrg.cpMax := EndPos;
TextRange.lpstrText := PAnsiChar(Result);
SetLength(Result, SendMessage(Handle, EM_GETTEXTRANGE, 0, Longint(@TextRange)));
end;
SelAttributes.Link:=True 2个汉字不会出错了 比如 确定,取消!