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;

2 Answers 2


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.


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;

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.