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

In my PageLayoutControl I add a ScaleBar. Additionaly I like to show the map scale/ratio (e.g. "1:20.000") next to it, but didn't find a way to achieve this with the ScaleBar. Am I missing something or is there another way to do this?

Here is, how I add the ScaleBar:

  IEnvelope envelope = new EnvelopeClass();
  envelope.PutCoords(5, 0.1, 12.4, 1); // Specify the location and size of the scalebar
  IUID uid = new UIDClass();
  uid.Value = "esriCarto.ScaleLine";

  // Create a Surround. Set the geometry of the MapSurroundFrame to give it a location
  // Activate it and add it to the PageLayout's graphics container
  IGraphicsContainer graphicsContainer = pageLayout as IGraphicsContainer;
  IActiveView activeView = pageLayout as IActiveView;
  IFrameElement frameElement = graphicsContainer.FindFrame(map);
  IMapFrame mapFrame = frameElement as IMapFrame;
  IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid as UID, null);
  IElement element = mapSurroundFrame as IElement;
  element.Geometry = envelope;
  graphicsContainer.AddElement(element, 0);
  IMapSurround mapSurround = mapSurroundFrame.MapSurround;

  IScaleBar markerScaleBar = (IScaleBar)mapSurround;
  markerScaleBar.LabelPosition = esriVertPosEnum.esriBelow;
share|improve this question
Not sure if this is the answer but there is some Java documentation on Map Surrounds that may hel at… – PolyGeo Oct 19 '11 at 22:40
@PolyGeo: Thanks, that pointed me in the right direction. See my answer. – gumo Oct 20 '11 at 7:55

As mentioned in my comment, the key information that pointed gumo in the right direction can be found in the Add Map Surrounds resource of ArcGIS Engine:

This sample demonstrates using the SymbologyControl to display north arrow,scale bar,and scale text symbols,which are used by custom commands when adding MapSurround objects to the GraphicsContainer of the PageLayout.The sample uses the SymbologyControl in conjunction with the PageLayoutControl, TOCControl, ToolbarControl,and the controls commands.

share|improve this answer
up vote 1 down vote accepted

ScaleText is the way to go. PolyGeo's link pointed me in the right direction. Thanks.

I use the same code as above apart from setting a ScaleText instead of a ScaleLine (line 4)

uid.Value = "esriCarto.ScaleText";

and setting different Options (last paragraph):

IScaleText2 markerScaleText = (IScaleText2)mapSurround;
markerScaleText.Separator = ":";
markerScaleText.Style = esriScaleTextStyleEnum.esriScaleTextAbsolute;
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.