[GIS] Obtaining envelope of data frame in Layout using ArcObjects

arcobjectslayouts

This is to expand on Transforming layout page units to map units using ArcObjects?

How can i programatically obtain the corner coordinates (in page units) or the envelope of the data frame in layout view?

I don't seem to be able to do this with iActiveView:Extent as it is returning the extent of the data view in page units. The below screen capture shows what I would like to get. The coordinates are roughly; upper left 0.9,10 and lower right 8, 0.9. Even in page layout iActive:extent returns: upper left -3.4, 12 and lower right 14,-3 which is the extent of the entire application window not the data frame as it appears in layout.

Here is what i need:
enter image description here

Best Answer

Cast the IMxDocument.FocusMap to IActiveView and retrieve current extent from the Extent property.

The map will always automatically modify its extent and other information when you switch from data frame view to the layout view (and back).

Related Question