ArcEngine我要获取当前shp图层的所有字段名,是不是必须先获取图层要素?
答案:1 悬赏:70 手机版
解决时间 2021-11-13 18:54
- 提问者网友:流星是天使的眼泪
- 2021-11-13 01:04
ArcEngine我要获取当前shp图层的所有字段名,是不是必须先获取图层要素?
最佳答案
- 五星知识达人网友:山君与见山
- 2021-11-13 02:41
是的,先得到IFeatureLayer
IFeatureLayer featureLayer = m_mapControl.get_Layer(0) as IFeatureLayer;
IFeatureClass featureClass = featureLayer.FeatureClass;
int num = featureClass.Fields.FieldCount;
List lstName = new List();
for (int i = 0; i < num; i++) {
string name = featureClass.Fields.get_Field(i).Name;
lstName.Add(name);
}
IFeatureLayer featureLayer = m_mapControl.get_Layer(0) as IFeatureLayer;
IFeatureClass featureClass = featureLayer.FeatureClass;
int num = featureClass.Fields.FieldCount;
List
for (int i = 0; i < num; i++) {
string name = featureClass.Fields.get_Field(i).Name;
lstName.Add(name);
}
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯