简单问题:如何把字符串插到memo中光标所停留的位置? 先获取当前光标位置,再插入字符串。有正确答案马上结贴,谢谢各位帮忙! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 uses ClipBrd;procedure TForm1.Button1Click(Sender: TObject);begin ClipBoard.AsText := 'abc'; showmessage(inttostr(Memo1.SelStart));//光标位置 Memo1.PasteFromClipboard;end; 谢谢楼上。不用Clipboard粘贴不行么?Memo中没有可以直接在光标处插入字符的方法么? procedure TForm1.Button1Click(Sender: TObject);begin Memo1.Text := Copy(Memo1.Text,1,Memo1.SelStart) + 'OK' + Copy(Memo1.Text,Memo1.SelStart+1,MaxInt);end; procedure TForm1.Button1Click(Sender: TObject);begin Memo1.SelText := '多种方法,任选';end; 楼主对此问题还有什么疑问吗?我对Memo没有特殊研究,所以看到题目就试验,所以刚开始给你的方法比较繁。 如何让CXGRID中某列值依条件设定可写或不可写 从内存读取的文件乱码问题 fastreport 条件打印 DBListBox问题 ADOQuery 的问题 问一个有关显示的问题 再送100分,有空就来接分啦 我的小程序,做成安装程序,是不是要加入别的dll呀 时间范围的sql查询!!! delphi中如何实现c中的'<<'和'>>'移位操作符?急..急..急..急..急.. DLL函数返回PChar类型字符串, 在调用这个DLL函数显示结果后面会多出一个#14这个字符, 为什么? 问几个菜鸟问题
procedure TForm1.Button1Click(Sender: TObject);
begin
ClipBoard.AsText := 'abc';
showmessage(inttostr(Memo1.SelStart));//光标位置
Memo1.PasteFromClipboard;
end;
不用Clipboard粘贴不行么?Memo中没有可以直接在光标处插入字符的方法么?
begin
Memo1.Text := Copy(Memo1.Text,1,Memo1.SelStart) + 'OK' + Copy(Memo1.Text,Memo1.SelStart+1,MaxInt);
end;
begin
Memo1.SelText := '多种方法,任选';
end;