This document is archived and information here might be outdated.  Recommended version.


IEditor.Location Property (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Editor)  

IEditor.Location Property

The last known location of the mouse.

[Visual Basic .NET]
Public ReadOnly Property Location As IPoint
[C#]
public IPoint Location {get;}

Product Availability

Available with ArcGIS Desktop.

Remarks

This property is set when you right-click on the edit sketch. Once a point has been stored in this property, it remains there until the next time you right-click on the edit sketch.

Use this property when creating custom commands in the sketch context menu that require a point location to perform some operation. For example, the 'Insert Vertex' command use the location property to determine where to add the new vertex.

If you need the location of the sketch tool for a command in the sketch tool context menu, use the ISketchTool::Location property.
[C#]
IEditor editor;
//get a reference to m_app(hook) in the ICommand::OnCreate method.
editor=m_app.FindExtensionByName("ESRI Object Editor")

IPoint point=new PointClass();
point=m_editor.Location;
System.Windows.Forms.MessageBox.Show(point.X.ToString("N2") + ", "
  + point.Y.ToString("N2"));
[Visual Basic .NET]
m_app was declared as a module level variable and set to hook in ICommand::OnCreate method. 
This could be used in the ICommand::OnClick method.
    
Dim m_editor As IEditor
m_editor=m_app.FindExtensionByName("ESRI Object Editor")
Dim point As IPoint
point=m_editor.Location
' To use the messge box you need to add the System.Windows.Forms reference. 
MessageBox.Show(point.X.ToString("N2") + ", " + point.Y.ToString("N2")

See Also

IEditor Interface | esriSketchConstraint Constants | ISketchTool Interface