AnsweredAssumed Answered

How to know whether an IElement object is moved or deleted on the map? or prevent it?

Question asked by huangs3 on Jan 30, 2014
Latest reply on Feb 3, 2014 by huangs3
Hi Everybody:

    I am writing an ArcMap 10.0 extension that provides a multiple step workflow. In one of the steps of the workflow, my code will generate a graphical element (IElement object) on the map display to give some information to user to continue next step, and my code is cleaning it up at the end (currently deleting all graphical elements on the map).

    However, in the design above the extension will prevent user from using graphical or text element by using the out-of-box "Draw" toolbar, because my extension will clean the elements up from time to time.

    I want to improve this but keeping the reference to the IElement object when it is created, and delete only it at the end instead of deleting all elements. However, the geraphical element can be deleted by tools in "Draw" toolbar. If it is accidentially deleted, my deletion code will throw exception at the end. Is there anyway for my code to detect whether that element is no longer existing?

    Alternatively, if I have a way to prevent user to delete or edit that element, it should also work, any method?

    Thank you!

Outcomes