Hi Allen,
Event “DrawingFeatures” is raised when features are about to be drawn in the layer. In the event arguments, there is a collection of features to be drawn. So I think it’s suitable for your scenario, I have tested it with the following code, it works.
private void LoadAnShapeFileFeatureLayer_Load(object sender, EventArgs e)
{
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);
WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay();
winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);
ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"…\SampleData\Data\Countries02.shp");
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green));
worldLayer.DrawingFeatures += new EventHandler<DrawingFeaturesEventArgs>(worldLayer_DrawingFeatures);
LayerOverlay staticOverlay = new LayerOverlay();
staticOverlay.Layers.Add(“WorldLayer”, worldLayer);
winformsMap1.Overlays.Add(staticOverlay);
winformsMap1.CurrentExtent = new RectangleShape(-10, -5, -5, -10);
winformsMap1.Refresh();
}
private void worldLayer_DrawingFeatures(object sender, DrawingFeaturesEventArgs e)
{
int i = e.FeaturesToDraw.Count;
}
Please let us know if you have further questions.
Regards,
Ivan