<summary>
Constructs based on query criteria
</summary>
<param name= "where" > Query conditions </param>
public void Filterlayer (string where)
{
Ifeaturelayer Flyr = (ifeaturelayer) axmapcontrol1.get_layer (0);
Ifeatureclass fcls = Flyr. Featureclass;
Iqueryfilter queryfilter = new Queryfilterclass ();
Queryfilter.whereclause = where;
Zoom to select result set and Highlight
Zoomtoselectedfeature (Flyr, queryfilter);
Flashing the selected map spot
Ifeaturecursor featurecursor = fcls. Search (QueryFilter, true);
Flashpolygons (Featurecursor);
}
<summary>
Zoom to select result set and Highlight
</summary>
<param name= "Pfeaturelyr" ></param>
<param name= "Pqueryfilter" ></param>
private void Zoomtoselectedfeature (Ifeaturelayer pfeaturelyr, Iqueryfilter pqueryfilter)
{
#region highlight the query to a feature collection
Symbol Edge Color
Irgbcolor Plinecolor = new RgbColor ();
plinecolor.red = 255;
Ilinesymbol ILSYMBL = new Simplelinesymbolclass ();
Ilsymbl.color = Plinecolor;
Ilsymbl.width = 5;
Define the symbol for the selected feature to be red
Isimplefillsymbol Ipsimplefillsymbol = new Simplefillsymbol ();
Ipsimplefillsymbol.outline = ILSYMBL;
RgbColor Pfillcolor = new RgbColor ();
Pfillcolor.green = 60;
Ipsimplefillsymbol.color = Pfillcolor;
Ipsimplefillsymbol.style = esrisimplefillstyle.esrisfsforwarddiagonal;
Select a feature set
Ifeatureselection pftselection = Pfeaturelyr as ifeatureselection;
Pftselection.setselectionsymbol = true;
Pftselection.selectionsymbol = (isymbol) Ipsimplefillsymbol;
Pftselection.selectfeatures (Pqueryfilter, esriselectionresultenum.esriselectionresultnew, false);
#endregion
Iselectionset pselectionset = Pftselection.selectionset;
Center Display selected features
Ienumgeometry Penumgeom = new Enumfeaturegeometry ();
Ienumgeometrybind penumgeombind = Penumgeom as Ienumgeometrybind;
Penumgeombind.bindgeometrysource (null, pselectionset);
Igeometryfactory pgeomfactory = new Geometryenvironmentclass ();
Igeometry Pgeom = Pgeomfactory.creategeometryfromenumerator (PENUMGEOM);
AxMapControl1.ActiveView.Extent = Pgeom.envelope;
AxMapControl1.ActiveView.Refresh ();
}
<summary>
Flashing the selected map spot
</summary>
<param name= "Featurecursor" ></param>
private void Flashpolygons (Ifeaturecursor featurecursor)
{
IArray Geoarray = new Arrayclass ();
IFeature feature = null;
while ((feature = Featurecursor.nextfeature ()) = null)
{
feature is a circular outer pointer, so you must use Shapecopy
Geoarray.add (feature. Shapecopy);
}
Flashing feature collection by ihookactions
Hookhelperclass m_phookhelper = new Hookhelperclass ();
M_phookhelper.hook = Axmapcontrol1.object;
Ihookactions hookactions = (ihookactions) m_phookhelper;
Hookactions.doactiononmultiple (Geoarray, Esrihookactions.esrihookactionspan);
Hookactions.doactiononmultiple (Geoarray, esrihookactions.esrihookactionsgraphic);
Hookactions.doactiononmultiple (Geoarray, esrihookactions.esrihookactionszoom);
Application.doevents ();
M_pHookHelper.ActiveView.ScreenDisplay.UpdateWindow ();
Hookactions.doactiononmultiple (Geoarray, Esrihookactions.esrihookactionsflash);
}
}
From:http://www.cnblogs.com/feilong3540717/archive/2011/07/27/2118651.html
Simultaneous flashing of multiple feature codes (Arcengine)