static public void FlashFeature(IFeature feature)
{
if (feature == null)
return;
IApplication app = ApplicationRef;
IMxDocument doc = (IMxDocument)(app.Document);
IFeatureIdentifyObj feature_identify_obj = new FeatureIdentifyObjectClass();
feature_identify_obj.Feature = feature;
((IIdentifyObj)feature_identify_obj).Flash(doc.ActiveView.ScreenDisplay);
}
其中ApplicationRef是:
static public IApplication ApplicationRef
{
get
{
Type obj_type = Type.GetTypeFromCLSID(typeof(AppRefClass).GUID);
IApplication obj = null;
try
{
obj = (IApplication)Activator.CreateInstance(obj_type);
}
catch {}
return obj;
}
}
或者,你可以通過創建圖形IGraphicsContainer IElement元素做到這一點,水木清華這樣的:
void ShowFeature(IFeature feature)
{
element.Geometry = geometry.Project(mapSpatialReference, feature.Shape);
graphicsContainer.AddElement(element, 0);
activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
featureHighlighted = true;
}
void HideFeature()
{
if (!featureHighlighted)
return;
graphicsContainer.DeleteElement(element);
activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
featureHighlighted = false;
}
您也可以嘗試:http://gis.stackexchange.com/ – mlsteeves 2011-03-22 14:47:49