可以通过Clipboard实现:
var
tc: TClipboard;
begin
tc := TClipboard.Create;
tc.AsText := 'asdf';
RichEdit1.PasteFromClipboard;
tc.Free;
end;
var
tc: TClipboard;
begin
tc := TClipboard.Create;
tc.AsText := 'asdf';
RichEdit1.PasteFromClipboard;
tc.Free;
end;
begin
richedit1.SelText:=str;
end;只要当前没有选中的文字,则在光标处插入str字符串,如果无法确定是否有选中文字,可以在前加一句:richedit1.SelLength:=0;