//C#
private void SelectByShape(IGeometry searchShape, IFeatureLayer searchTarget)
{ //set up the spatial filter
t.FeatureClass; ISpatialFilter spatialFilter = new Spat
IFeatureClass featureClass = searchTarg
eialFilterClass(); spatialFilter.Geometry = searchShape;
; spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatia
spatialFilter.GeometryField = featureClass.ShapeFieldNam
elRelIntersects; IFeatureSelection featureSelection = searchTarget as IFeatureSelection;
esriSelectionResultEnum.esriSelectionResultNew,
featureSelection.SelectFeatures(spatialFilter,
false); //Fire the selection changed event featureSelection.SelectionChanged();
//Refresh the visible extent this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection,
searchTarget, this.axMapControl1.ActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds); }
hape, selectionEnvironmet, fals
//Ex2 using IMap::SelectByShape rivate void SelectByShape(IGeometry searchShape, IMap map, ISelectionEnvironment selectionEnvironmet) { map.SelectByShape(search
Se); //Refresh the visible extent this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null,
}
this.axMapControl1.ActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds);