5

I see that different starting points are used when interacting with ArcMap IMxDocument

  IMxDocument mxDocument = application.Document as IMxDocument;

  IActiveView activeView = mxDocument.ActiveView;  
  //IActiveView activeView = mxDocument.FocusMap as IActiveView;
  //IActiveView activeView = mxDocument.PageLayout as IActiveView;

  // Get an envelope corresponding to the view extent.
  IEnvelope envelope = activeView.Extent;

What is the difference between mxDocument.ActiveView, mxDocument.FocusMap and mxDocument.PageLayout related their extent? Are they going to be different?

In what case each can be used?

1 Answer 1

11

In ArcMap, normally you have the Data View, and you have a PageLayout View. Additionally, you'll have atleast one DataFrame, out of which only one can be active.

This is reflected in the various ArcObjects Interfaces.

  • The IMxDocument.FocusMap refers to the DataFrame which is in Focus.

  • The IMxDocument.PageLayout refers to the PageLayout

  • The IMxDocument.ActiveView refers to the Active View. This can be the PageLayout if it is currently being displayed, or the DataFrame which is in focus, if the Data View is currently being displayed.

You also need to remember that if you programmatically open a Map Document, the Active View is not completely Initialized. That is why you need to call IActiveView.Activate() on it.

1
  • @mitaka: Glad to help you out! Commented Jun 22, 2013 at 1:52

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.