//这个方法绝对可以,index是你的任意行序列号。这个是绝对定位到行头,
方法比较丑,别扔东西!!哈哈,给分!
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
var Count:integer;
var Index:integer;
begin
Index:=3;
Count:=0;
For i:=0 to Index-2 do
begin
Count:=Length(Memo1.Lines.Strings[i])+Count;
end;
Count:=Count+(Index-1)*2;
Memo1.SelStart:=Count;
Form1.ActiveControl:=Memo1;
end;
方法比较丑,别扔东西!!哈哈,给分!
procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
var Count:integer;
var Index:integer;
begin
Index:=3;
Count:=0;
For i:=0 to Index-2 do
begin
Count:=Length(Memo1.Lines.Strings[i])+Count;
end;
Count:=Count+(Index-1)*2;
Memo1.SelStart:=Count;
Form1.ActiveControl:=Memo1;
end;
如果要使memo中,当光标所在那一行为空时,回车光标不下移。怎么实现?