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.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Oct 22, 2012 at 12:47

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;
answered Oct 23, 2012 at 10:50
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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.