3

I have annotations stored in mxd document, when I select some annotation, I tried to get the selection through graphics selection, so I always get the rectangle of the dataframe (because I'm working on a axPageLayoutControl), and when I use feature selection I get nothing; so none of them return the annotation selection.

How could I get the annotation selection in ArcObjects?

I'm using ArcObjects 10.1.

1 Answer 1

2

Annotations are stored in the Graphicscontainer of BasicGraphicsLayer, so this code get the selection of Annotations, it works for me :)

IGraphicsContainerSelect graContSel = (IGraphicsContainerSelect)mapDocument.ActiveView.FocusMap.BasicGraphicsLayer;

m_enumElem = graContSel.SelectedElements; 

m_enumElem.Reset();

elem = m_enumElem.Next();

ITextElement txel = elem as ITextElement;
1
  • 1
    +1 However, I've found IEnumElement will often not start at the beginning unless I explicitly call Reset(). Commented Oct 23, 2012 at 13:29

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.