1IEnumFeature enumFeature = (IEnumFeature)MapCtrMain.Map.FeatureSelection;
2IFeature pFeature = enumFeature.Next();
3
4while (pFeature != null && k < 500)
5{
6 pFeature.get_Value(0).ToString());
7 pFeature = enumFeature.Next();
8}
9
2IFeature pFeature = enumFeature.Next();
3
4while (pFeature != null && k < 500)
5{
6 pFeature.get_Value(0).ToString());
7 pFeature = enumFeature.Next();
8}
9
在上面的代码中,如果选取的要素很多,则无法获取pFeature的属性值,即pFeature.get_Value(i)为空!
查看帮助后得知,IEnumFeature获取的要素,仅仅是用来显示的。要想获取pFeature的属性值,需要另外
一个接口:IEnumFeatureSetup。
1IEnumFeature enumFeature = (IEnumFeature)MapCtrMain.Map.FeatureSelection;
2IEnumFeatureSetup enumFeatureSetup = (IEnumFeatureSetup)enumFeature;
3enumFeatureSetup.AllFields = true;
4IFeature pFeature = enumFeature.Next();
2IEnumFeatureSetup enumFeatureSetup = (IEnumFeatureSetup)enumFeature;
3enumFeatureSetup.AllFields = true;
4IFeature pFeature = enumFeature.Next();
这样以后就可以用了