ArcOjbects 获取当前地图选择要素属性信息
ISelection pSelection = MainMapControl.Map.FeatureSelection; IEnumFeatureSetup iEnumFeatureSetup = (IEnumFeatureSetup)pSelection; iEnumFeatureSetup.AllFields = true; IEnumFeature pEnumFeature = (IEnumFeature)iEnumFeatureSetup; pEnumFeature.Reset(); IFeature pFeature = pEnumFeature.Next(); if (pFeature != null) { int index = pFeature.Fields.FindField("HeritageNu"); if (index != -1) { string hid = pFeature.get_Value(index).ToString(); ..... } }
IEnumFeatureSetup iEnumFeatureSetup = (IEnumFeatureSetup)pSelection;
iEnumFeatureSetup.AllFields = true;
这两句代码非常重要,不然获取不到选中要素属性信息
博客园:http://www.cnblogs.com/upcwangbo/
邮箱:upcwangbo@163.com

浙公网安备 33010602011771号