procedure TForm1.Button1Click(Sender: TObject);
var
x:integer;
temp1,temp2:string;
begin
x:=Memo1.SelStart;
temp1:=copy(memo1.text,0,x-1);
temp2:=copy(memo1.text,x,length(memo1.text)-x);
temp1:=temp1+'This is inserted';
temp2:=temp1+temp2;
memo1.Text :=temp2;
memo1.selstart:=x+length('This is inserted');
end;这段例子中的插入的字符串可以用一个变量来替换,如果是RICHEDIT控件也可如法炮制。
var
x:integer;
temp1,temp2:string;
begin
x:=Memo1.SelStart;
temp1:=copy(memo1.text,0,x-1);
temp2:=copy(memo1.text,x,length(memo1.text)-x);
temp1:=temp1+'This is inserted';
temp2:=temp1+temp2;
memo1.Text :=temp2;
memo1.selstart:=x+length('This is inserted');
end;这段例子中的插入的字符串可以用一个变量来替换,如果是RICHEDIT控件也可如法炮制。
解决方案 »
- 按僵哥的话说,成为猩猩了,散分
- qreport遇到的小问题!
- 请教高手,如何将WORD和EXCEL文档保存到SQL数据库里面?
- 谁能给我一个能在服务程序下强制关机2000/XP的代码?
- Delphi 2005中如何安装ActiveX控件?怎么不像DELPHI7中的一样,
- 谢谢
- 急寻找 文魁,碁峰 或 儒林 or 松岗出版社 的网址或联系方法
- 如何将一个byte型转换成string型?
- 请问:fastreport的自定义变量如何与delphi变量进行互相传递!!!
- 请问如何把一段SQL脚本做为可执行EXE文件?高分送你!!!!!!!!!!
- 怎样在软件里设计容易扩充功能和使用的插件?
- 大虾救我:如何将MDI窗口内坐标进行统一?
memo1.Seltext:='This is insert text';