Dan,
Thanks for your post, please refer the following code for your requirement:
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);
// Draw thematic features
ClassBreakStyle classBreakStyle = new ClassBreakStyle("POP_CNTRY");
classBreakStyle.ClassBreaks.Add(new ClassBreak(double.MinValue, AreaStyles.Grass1));
classBreakStyle.ClassBreaks.Add(new ClassBreak(1000000, AreaStyles.Evergreen2));
classBreakStyle.ClassBreaks.Add(new ClassBreak(10000000, AreaStyles.Evergreen1));
classBreakStyle.ClassBreaks.Add(new ClassBreak(50000000, AreaStyles.Crop1));
classBreakStyle.ClassBreaks.Add(new ClassBreak(100000000, AreaStyles.Forest1));
ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp");
worldLayer.Open();
InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer();
inMemoryFeatureLayer.Open();
inMemoryFeatureLayer.Columns.Add(new FeatureSourceColumn("POP_CNTRY"));
Collection<Feature> features = worldLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns);
for (int i = 0; i < 100; i++)
{
inMemoryFeatureLayer.InternalFeatures.Add(features[i]);
}
inMemoryFeatureLayer.Close();
worldLayer.Close();
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(AreaStyles.Country1);
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(classBreakStyle);
LayerOverlay layerOverlay = new LayerOverlay();
layerOverlay.Layers.Add(inMemoryFeatureLayer);
winformsMap1.Overlays.Add(layerOverlay);
winformsMap1.ZoomLevelSnapping = ZoomLevelSnappingMode.Default;
winformsMap1.CurrentExtent = new RectangleShape(-143.4, 109.3, 116.7, -76.3);
winformsMap1.Refresh();
In the sample code above you just need to replace the shape file location to your own shape file and create the special InMemoryFeatureLayer according to the source shape file, also you need to change the column name in the code above.
If you encounter any problems when using the code above please let us know and send your shape file to us, we will make a sample for you,
Thanks,
Scott,