I use vb.net arcobjects create a buffer around a polyline feature once it is selected. The problem is the buffer has a obvious colour. Since I have other functions on the selected feature, I cannot clear the buffer because user may still need the feature selected.
When I select another feature, the new buffer will created and old buffer cleared. But there always a buffer which makes the polyline there looks different from other features in the same layer.
So I am thinking whether can make the buffer transparent so that it wouldn't affect the overview of the map.
My code is from an ESRI web sample:
Public Sub CreateGraphicBuffersAroundSelectedFeatures(ByVal activeView As ESRI.ArcGIS.Carto.IActiveView, ByVal distance As System.Double) 'parameter check If activeView Is Nothing OrElse distance < 0 Then Return End If Dim map As ESRI.ArcGIS.Carto.IMap = activeView.FocusMap ' Clear any previous buffers from the screen Dim graphicsContainer As ESRI.ArcGIS.Carto.IGraphicsContainer = CType(map, ESRI.ArcGIS.Carto.IGraphicsContainer) ' Explicit Cast graphicsContainer.DeleteAllElements() ' Verify there is a feature(s) selected If map.SelectionCount = 0 Then Return End If ' Reset to the first selected feature Dim enumFeature As ESRI.ArcGIS.Geodatabase.IEnumFeature = CType(map.FeatureSelection, ESRI.ArcGIS.Geodatabase.IEnumFeature) ' Explicit Cast enumFeature.Reset() Dim feature As ESRI.ArcGIS.Geodatabase.IFeature = enumFeature.Next() ' Buffer all the selected features by the buffer distance and create a new polygon element from each result Dim topologicalOperator As ESRI.ArcGIS.Geometry.ITopologicalOperator Dim element As ESRI.ArcGIS.Carto.IElement Do While Not (feature Is Nothing) topologicalOperator = CType(feature.Shape, ESRI.ArcGIS.Geometry.ITopologicalOperator) ' Explicit Cast element = New ESRI.ArcGIS.Carto.PolygonElementClass() element.Geometry = topologicalOperator.Buffer(distance) graphicsContainer.AddElement(element, 0) feature = enumFeature.Next() Loop activeView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGraphics, Nothing, Nothing) End Sub
I am using vb.net arcobjects and arcmap 10.2. Any advice on it?