When adding a point feature to a map in ArcGIS Desktop 10 by clicking in the map using an add-in tool or a COM component base tool, the coordinates of the newly created point are incorrect.
The coordinates are incorrect because they are currently screen coordinates, and not map coordinates.
/// The code herein is based on the Add-In sample at this link on ESRI's Resources Website:
public class Class_OnMouseDown_Tool : ESRI.ArcGIS.Desktop.AddIns.Tool
// Module level variables
private IActiveView m_focusMap;
protected override void OnUpdate()
Enabled = ArcMap.Application != null;
protected override void OnMouseDown(MouseEventArgs arg)
IMxDocument mxDoc = ArcMap.Document;
m_focusMap = mxDoc.FocusMap as IActiveView;
IPoint point = m_focusMap.ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y) as IPoint;
"point.X = " + point.X + "\n" +
"point.Y = " + point.Y + "\n"