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 tried to get IGraphicsContainer from Data View (active map) using FocusMap, ActiveView

IGraphicsContainer graphicsContainer = (IGraphicsContainer)neApp.Document.MxDocument.FocusMap;

but the variable always null, is there any different way to do this?


I already get from page layout view in this question right here: Get IGraphicsContainer from page layout but i need it from data view (map).

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

The Map class does implement IGraphicsContainer, so most likely the problem is in the expression neApp.Document.MxDocument.FocusMap. Make sure it does not return null.

Also be aware that a map can contain multiple graphic layers. See the discussion in IMap.BasicGraphicsLayer documentation for details.

share|improve this answer
    
Thanks, can you know how to change the view from layout view to data view see this question, gis.stackexchange.com/questions/43593/… –  RASHOMON Dec 10 '12 at 7:27
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.