[GIS] Display map scale (like 1:20.000) next to ScaleBar

arcgis-10.0arcgis-enginearcobjects

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;
  element.Activate(activeView.ScreenDisplay);
  graphicsContainer.AddElement(element, 0);
  IMapSurround mapSurround = mapSurroundFrame.MapSurround;

  IScaleBar markerScaleBar = (IScaleBar)mapSurround;
  markerScaleBar.LabelPosition = esriVertPosEnum.esriBelow;
  markerScaleBar.UseMapSettings();

Best Answer

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.

Related Question