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
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 However, I've found IEnumElement will often not start at the beginning unless I explicitly call Reset().Kirk Kuykendall– Kirk Kuykendall2012年10月23日 13:29:33 +00:00Commented Oct 23, 2012 at 13:29