protected override void OnSelChange(int cookie) { if (cookie < 0) { return; } s_selectedLayer = this.GetItem(cookie).Caption; CboFields.ClearAllItems(); IMap map = (ArcMap.Document as IMxDocument).FocusMap; for (int i = 0; i < map.LayerCount; i++) { ILayer layer = map.Layer[i]; if (layer.Name == s_selectedLayer) // && layer is IFeatureLayer { IFeatureClass fClass = (layer as IFeatureLayer).FeatureClass; for (int j = 0; j < fClass.Fields.FieldCount; j++) { switch (fClass.Fields.Field[j].Type) { case esriFieldType.esriFieldTypeDouble: case esriFieldType.esriFieldTypeInteger: case esriFieldType.esriFieldTypeSingle: case esriFieldType.esriFieldTypeSmallInteger: CboFields.AddItem(fClass.Fields.Field[j].Name); break; } } break; } } CboRenderers.UpdateRenderers(); }
internal void PopulateCboLayers(object item) { map = (ArcMap.Application.Document as IMxDocument).FocusMap; CboFields.ClearAllItems(); CboLayers.ClearAllItems(); ILayer layer; for (int i = 0; i < map.LayerCount; i++) { layer = map.Layer[i]; if (map.Layer[i] is IFeatureLayer) { CboLayers.AddItem(layer.Name); } } }