I am trying to build an add-in that will create a polygon from the current map extent. This is not a problem in Data View where I can easily get the envelope of an iMxDocument:iActiveView in data view. I need to do the same in Layout view, preferably without switching back and forth between layout and data views.

When in Layout the iActiveView:Extent:Envelope returns an envelope coordinates of the map position with respect to the layout. (position of the map frame on paper so to speak) How do I transform these into actual map coordinates? I tried using iDisplayTransoformation:ToMapPoint but the input needs to be a screen point and the coordinates I have are of the map frame with respect to layout, not screen coordinates.

In other words i need to transform page units to map units whereas iDisplayTransformation will transform only screen nits to map units or screen units to page units.


1 Answer 1


Found it: iDisplayTrasformation:TransformRect

VB example in Transform Rectangle from Page to Map Units:

You can use this function to transform an envelope (rectangle) from page units to map units.

  • I wonder if that code does when the map is rotated slightly (IDisplaytransformation.Rotation != 0). To handle that case, it seems like you'd need to use four corner points instead of a rectangle. TransformPointsFI to get from page to device units, then TransformPointsIF to go from device to map. Jul 6, 2012 at 1:47
  • Thanks @Kirk. That sounds like a better approach. I am running into some issues with the linked sample. Jul 6, 2012 at 4:02
  • @KirkKuykendall - would you be able to add a code snippet or a link to one as a separate answer? The code in the link I posted gets me an envelope of the data frame when in layout but not the extent of the layout map frame. I will add some visual to illustrate what I am after... Jul 6, 2012 at 13:36

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.