ArcEngine点选属性
ESRI.ArcGIS.Geometry.Point point = new ESRI.ArcGIS.Geometry.Point();
point.X = e.mapX; //在axMapControl_OnMouseDown事件中
point.Y = e.mapY;
Geometry = point as IGeometry;
axMapControl1.Map.SelectByShape(Geometry, null, true);
axMapControl1.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null); //选中要素高亮显示
ILayer layer = axMapControl1.Map.get_Layer(0); //获取layer,这里只有一个图层所以直接写了
IMap map = axMapControl1.Map;
IFeatureLayer FeatureLayer = layer as IFeatureLayer;
IFeatureSelection featureSelection;
featureSelection = FeatureLayer as IFeatureSelection;
long id = featureSelection.SelectionSet.IDs.Next(); //获取选中要素的ID值。
IFeatureClass featureClass=FeatureLayer.FeatureClass;
IQueryFilter queryFilter = new QueryFilterClass(); //创建一个查询筛选
queryFilter.WhereClause = "OBJECTID =" + id; //查询条件,即选中获取的ID
queryFilter.SubFields = "SHAPE_Area";
int fieldPosition = featureClass.FindField("SHAPE_Area"); //获取字段(这里是SHAPE_Area),其他字段同理
IFeatureCursor featureCursor = featureClass.Search(queryFilter, true);
IFeature feature = null;
while ((feature = featureCursor.NextFeature()) != null)
{
MessageBox.Show(feature.get_Value(fieldPosition).ToString()); //获取字段的值。
}