AnsweredAssumed Answered

How to add handler to mouse click on the map of ArcMap?

Question asked by huangs3 on Jun 14, 2012
Latest reply on Jun 21, 2012 by huangs3
Hi Everybody:

    I am writing an ArcMap 10 extension using C#. I want to detect the user's mouse click on the map. However, I haven't successfully get it done.

    I notice that IMapControlEvent2 should give a delegate to handle the event, but I don't know how to get IMapControlEvent2 out of the current application. I did the following but it doesn't work:
***************************************************************
IActiveView view = (_mApplication.Document as IMxDocument).ActivatedView;
IMapControlDefault mapControlDefault = new MapControl();
mapControlDefault.Map = view.FocusMap;
IMapControlEvents2 mapControlEvents = mapControlDefault as IMapControlEvents2;
***************************************************************

    How shall I do it?
    Thank you!

Outcomes