ThinkGeo.com    |     Documentation    |     Premium Support

Transparent Area

I've been trying to figure this out for a couple days so far to no luck, but I'm convinced I'm just not looking in the right place.


When you're creating a polygon using TrackShapes, you get this nice transparent green area while you're defining it. How can I get that same transparent look on a polygon once it's defined. Truthfully, I need the area to not be green but be a color that I can define while still allowing the information behind it to be seen.


Thanks for your help!


Kimberly






 

 


Kimberly,

 


We can set the alpha value for a color, 255 means concrete and 0 means totally transparent. Set that color for an AreaStyle and you can easily get that effect. For example, replace the sample Getting Started ->DisplayASimpleMap with the following codes and you will get a transparent US


 



 


 
     private void DisplayMap_Load(object sender, EventArgs e)   
        {   
            winformsMap1.MapUnit = GeographyUnit.DecimalDegree;   
            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp");   
            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;   
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;   
  
            ShapeFileFeatureLayer USLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\USStates.shp");   
            USLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoSolidBrush(GeoColor.FromArgb(50, GeoColor.StandardColors.Green)));   
            USLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;   
  
            winformsMap1.StaticOverlay.Layers.Add("WorldLayer", worldLayer);   
            winformsMap1.StaticOverlay.Layers.Add("USLayer", USLayer);   
            winformsMap1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);   
            winformsMap1.CurrentExtent = new RectangleShape(-180.0, 83.0, 180.0, -90.0);   
  
            winformsMap1.Refresh();   
        }   

Thanks,


Ben



Thank you! This is exactly what I needed!  
  
 (Sorry for the delayed response. Somehow I managed to get myself unsubscribed to the topic.) 
  
 Kimberly

That’s great, Kimberly.