Assuming you have some way of finding the features you're after you can draw them on the screen as a temporary graphic (once) which will disappear on the next refresh or wire the AfterDraw event and call refresh which will run every time the view is refreshed.
Private Sub UltraHighlight(FeatureLayer As ESRI.ArcGIS.Carto.IFeatureLayer, OIDList As List(Of Long))
Dim pLineSymbol As ESRI.ArcGIS.Display.ISimpleLineSymbol = New ESRI.ArcGIS.Display.SimpleLineSymbolClass()
Dim pPolySymbol As ESRI.ArcGIS.Display.ISimpleFillSymbol = New ESRI.ArcGIS.Display.SimpleFillSymbolClass()
Dim pMarkSymbol As ESRI.ArcGIS.Display.ISimpleMarkerSymbol = New ESRI.ArcGIS.Display.SimpleMarkerSymbol()
Dim pColour As ESRI.ArcGIS.Display.IColor = New ESRI.ArcGIS.Display.RgbColorClass()
pColour.RGB = &HFFFF00 ' Hex for yellow'
pLineSymbol.Width = 3 ' nice and wide'
pLineSymbol.Color = pColour
pLineSymbol.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid
pPolySymbol.Outline = pLineSymbol ' use the wide yellow line as an outline'
pPolySymbol.Color = pColour ' and fill with yellow'
pPolySymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSSolid
pMarkSymbol.Size = 12
pMarkSymbol.Color = pColour
pMarkSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle
' tell ArcGis you want to use the symbols now created'
' you can specify 4 symbols (line, marker, fill and text)'
' but only one of each. Note gMXDocument is a global IMXDocument'
' you can only draw to the screen between calls to IActiveView.ScreenDisplay.StartDrawing'
' and IActiveView.ScreenDisplay.FinishDrawing unless you are responding to the IActiveViewEvents::AfterDraw'
' event. See http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//001w000000vr000000'
' somehow identify the features you want to draw.. I'll call it an OID set as a list'
' because its easy to show what's happening. You need to customize it for your tool'
Dim pFeat As IFeature
Dim pGeom As IGeometry
For Each ThisOID As Long In OIDList
pFeat = FeatureLayer.FeatureClass.GetFeature(ThisOID)
pGeom = pFeat.ShapeCopy
If Not pGeom.IsEmpty Then
If pGeom.GeometryType = esriGeometryType.esriGeometryLine Then
ElseIf pGeom.GeometryType = esriGeometryType.esriGeometryPolygon Then
ElseIf pGeom.GeometryType = esriGeometryType.esriGeometryPoint Then
ElseIf pGeom.GeometryType = esriGeometryType.esriGeometryMultipoint Then
Catch ex As Exception
Debug.Print("Unable to select feature")
The workflow is:
- Create your symbols. Not knowing what features you're expecting create one for polygon, line and point; these all implement ISymbol which is what is required for SetSymbol.
- Set the symbols for your active view screen display.
- Start drawing, if you don't do this there may not be any errors shown but nothing will draw.
- Find your features, obtain the geometries then using the IGeometry.GeometryType enumeration draw your geometries with DrawPolyline, DrawPolygon, DrawPoint or DrawMultipoint, each one will draw a specific geometry type only.
- Finish drawing, same as start drawing, no errors may be generated but nothing will appear.
You can see another example in the Flash Geometry Snippet.
As the drawing will go away on the next refresh if you want to make this permanent then you will need call this during IActiveViewEvents::AfterDraw with esriViewDrawPhase.esriViewGeoSelection or esriViewGraphics; I'm not sure which phase will fire just after the selected features - if you operate on the earlier phase the drawing will appear and be masked by the features or selection!
If you are responding to the AfterDraw event comment out