ThinkGeo.com    |     Documentation    |     Premium Support

Use Negative backgournd for ScaleLine

We develop a multi-theme application, but I don’t know how can I change the color of ScaleLines and ScaleNumbers, but I saw most of the web-based Map control has a property to set the color based on the background color, a kind of Negative background.

Thanks Mahdi,

mapView.MapTools.ScaleLine not allow you set the color for the text and the line. I recommend us the ScaleLineAdornmentLayer to do this.

Here is the sample code:

    ScaleLineAdornmentLayer sla = new ScaleLineAdornmentLayer(AdornmentLocation.LowerLeft);
    sla.TextStyle = new TextStyle("ScaleBarText", new GeoFont("Arial", 6.5f), new GeoSolidBrush(GeoColors.Red));
    sla.Pen = new GeoPen(GeoColors.Red, 2f);
    AdornmentOverlay ao = new AdornmentOverlay();
    ao.Layers.Add(sla);
    mapView.Overlays.Add(ao);
    mapView.Refresh();

Thanks

Frank