- //给定图层,字段及一个值,查找Feature对象,
- //参数列表: pLayer----------图层
- //strFldName------字段名
- //strFldValue-----属性值
- public IFeature FindFeature(ILayer pLayer, string strFldName, string strFldValue)
- {
- IFeatureLayer featLyr = pLayer as IFeatureLayer;
- IFeatureClass featCls = featLyr.FeatureClass;
- IFeatureCursor featCur;
- IFeature feat;
- IQueryFilter pFliter = new QueryFilterClass();
- pFliter.WhereClause = strFldName + "=" + "'" + strFldValue + "'";
- featCur = featCls.Search(pFliter, false);
- feat = featCur.NextFeature();
- return feat;
- }