Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

i have annotations stored in mxd document, when i select some annotation , i tried to get the selection through graphics selection, so i got always the rectangle of the dataframe (because i'm working on a axPageLayoutControl), and when i use features 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

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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;
share|improve this answer
1  
+1 However, I've found IEnumElement will often not start at the beginning unless I explicitly call Reset(). –  Kirk Kuykendall Oct 23 '12 at 13:29
    
Thanks @KirkKuykendall, answer updated. –  geogeek Oct 23 '12 at 16:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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