打印本文 打印本文 关闭窗口 关闭窗口
获得Memo、RichEdit的光标位置
作者:武汉SEO闵涛  文章来源:敏韬网  点击数1011  更新时间:2009/4/23 18:37:42  文章录入:mintao  责任编辑:mintao

获得Memo、RichEdit的光标位置:


procedure TForm1.Button1Click(Sender: TObject);
var Row, Col : integer;
begin
  Row := SendMessage(Memo1.Handle, EM_LINEFROMCHAR, Memo1.SelStart, 0);
  Col := CustEdit.SelStart - SendMessage(Memo1.Handle, EM_LINEINDEX, -1, 0);
  Edit1.Text:=''''行,列:''''+IntToStr(Row)+'''',''''+IntToStr(Col);
end;


superyoyonc@sohu.com

打印本文 打印本文 关闭窗口 关闭窗口