4

Using the esriControls.ControlsSelectTool I select a text element that I have previously placed on the map. In code, how can I find this element on the map? I know I can iterate using the IGraphicsContainer but how can I tell that the element is the selected element?

1 Answer 1

2

Should have known another interface would be waiting (given that 'view' is an IActiveView):

IElement selectedElement = null;
IGraphicsContainerSelect graphicsContainerSelect = 
    view.FocusMap as IGraphicsContainerSelect;
if ( graphicsContainerSelect == null ) return selectedElement;
if ( graphicsContainerSelect.ElementSelectionCount == 0 ) return selectedElement;
IEnumElement enumElement = graphicsContainerSelect.SelectedElements;
selectedElement = enumElement.Next();
while ( selectedElement != null ) {
    // whatever
    selectedElement = enumElement.Next();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.