- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi取得TRichEdit的光标当前位置
function GetPosition(ARichEdit: TRichEdit): string
var
iX,iY : Integer;
begin
iX := 0; iY := 0;
iY := SendMessage(ARichEdit.Handle,
EM_LINEFROMCHAR,
ARichEdit.SelStart,0) ;
iX := ARichEdit.SelStart -
SendMessage(ARichEdit.Handle,
EM_LINEINDEX, iY, 0) ;
Result := IntToStr(iY + 1) + ':' + IntToStr(iX + 1) ;
end;