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();
أكثر...
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();
أكثر...