Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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? Thanks in advance.

share|improve this question
up vote 2 down vote accepted

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();
share|improve this answer

Your Answer


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.