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.