procedure TForm1.Button1Click(Sender: TObject);
var
i,j :integer;
begin
getxy(i,j);
ShowMessage(Format('row=%d,col=%d',[i,j]));
end;
procedure TForm1.getxy(var i,j :integer);
var
iIndex :Integer;
begin
i := SendMessage(Memo1.handle,em_lineFromChar,-1,0);
iindex :=SendMessage(Memo1.handle,em_lineindex,i,0);
j := Memo1.selstart+Memo1.SelLength-iindex;
end;
是以前从已答问题中抄下来的.很好.