取得TMemo 控件当前光标的行和列信息到Tpoint中......
作者:陈立平 来源:yesky 2007年11月1日
关键字: Delphi 编辑
1. 取得TMemo 控件当前光标的行和列信息到Tpoint中
function ReadCursorPos(SourceMemo: TMemo): TPoint;
var
Point: TPoint;
begin
point.y := SendMessage(SourceMemo.Handle, EM_LINEFROMCHAR,SourceMemo.SelStart,0);
point.x := SourceMemo.SelStart- SendMessage(SourceMemo.Handle,EM_LINEINDEX,point.y,0);
Result := Point;
end;
2.检查Tmemo控件能否Undo和如何实现Undo功能
Function CanUndo(AMemo: TMemo): Boolean;
Begin
Result := AMemo.Perform(EM_CANUNDO, 0, 0) $#@60;$#@62; 0;
End;
Procedure Undo(Amemo: Tmemo);
Begin
Memo1.Perform(EM_UNDO, 0, 0);
End;