L LuckyJackie Unregistered / Unconfirmed GUEST, unregistred user! 2007-09-30 #1 主要是想得到被选中文本的起始段落号与结束段落号 CLX中好像有对应属性property Selection: TMemoSelection;,VCL中没有
M myid0602 Unregistered / Unconfirmed GUEST, unregistred user! 2007-09-30 #2 var L1,L2:integer; //起始行号,结束行号。(第一行为0) begin L1:=SendMessage(memo1.Handle,EM_LINEFROMCHAR,Memo1.SelStart,0); L2:=SendMessage(memo1.Handle,EM_LINEFROMCHAR,Memo1.SelStart+Memo1.SelLength,0); end;
var L1,L2:integer; //起始行号,结束行号。(第一行为0) begin L1:=SendMessage(memo1.Handle,EM_LINEFROMCHAR,Memo1.SelStart,0); L2:=SendMessage(memo1.Handle,EM_LINEFROMCHAR,Memo1.SelStart+Memo1.SelLength,0); end;
J jialiguo Unregistered / Unconfirmed GUEST, unregistred user! 2007-11-21 #4 LineNum:longint; CharsBeforeLine:longint; begin 行 LineNum:=SendMessage(Memo1.Handle,EM_LINEFROMCHAR,Memo1.SelStart,0); 列 CharsBeforeLine:=SendMessage(Memo1.Handle,EM_LINEINDEX,LineNum,0); Label1.Caption:='Line'+IntToStr(LineNum+1); Label2.Caption:='Position'+IntToStr((Memo1.SelStart-CharsBeforeLine)+1);
LineNum:longint; CharsBeforeLine:longint; begin 行 LineNum:=SendMessage(Memo1.Handle,EM_LINEFROMCHAR,Memo1.SelStart,0); 列 CharsBeforeLine:=SendMessage(Memo1.Handle,EM_LINEINDEX,LineNum,0); Label1.Caption:='Line'+IntToStr(LineNum+1); Label2.Caption:='Position'+IntToStr((Memo1.SelStart-CharsBeforeLine)+1);