For printing we have a PageLayoutControl where the user can select the map extent, he wants to print. I like the map to fill only a square in the middle of the page so that the title, the ScaleBar and some additional texts appear on top and underneath the map. By now the map fills the hole page. How can I resize the map?

I tried setting the envelopes x and y values, but with no success:

public void SizeMap(IPageLayout pageLayout, IActiveView activeView)
  IMap map = activeView.FocusMap;
  IGraphicsContainer graphicsContainer = pageLayout as IGraphicsContainer;
  IFrameElement frameElement = graphicsContainer.FindFrame(map);
  IMapFrame mapFrame = (IMapFrame)frameElement;

  IElement mainMap_Element = mapFrame as IElement;
  IGeometry geometry = mainMap_Element.Geometry;
  IEnvelope mainMap_Envelope = geometry.Envelope;

  mainMap_Envelope.YMin = 5; // only example values
  mainMap_Envelope.YMax = 12;

  activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

Is this the right approach?

1 Answer 1


After some research I found the following solution:

IGraphicsContainer pGraphicsContainer = _pageLayoutControl.GraphicsContainer;
IElement pElement = pGraphicsContainer.Next();
while (pElement != null)
  if (pElement is IMapFrame)
    IMapFrame pMapFrame = pElement as IMapFrame;
    IEnvelope pEnvelope = new EnvelopeClass();
    pEnvelope.PutCoords(0.5, 0.5, 11.5, 11.5);
    pElement.Geometry = pEnvelope;
  pElement = pGraphicsContainer.Next();

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.