I am able to create graphics and add them to the map, but they are getting added as the top-most layer.
The labels (if active) of another layer get hidden due to this. I want to know how to add graphics as the lowest layer in the active map.
EDIT 1: Here is the code which I am using to add graphics to the map
Dim graphicsContainer As IGraphicsContainer
graphicsContainer = GetRunningApplication(My.ArcMap.Application.Document.Title).FocusMap
Dim elem As IElement
Dim rgbcolor As IRgbColor
Dim outlineRGBColor As IRgbColor
elem = Nothing
rgbcolor = New RgbColor
If (g.GeometryType) = esriGeometryType.esriGeometryPoint Then
' Marker symbols
Dim simpleMarkerSymbol As ISimpleMarkerSymbol
simpleMarkerSymbol = New SimpleMarkerSymbol
'set COlors
rgbcolor.Blue = 255
rgbcolor.Red = 0
rgbcolor.Green = 0
simpleMarkerSymbol.Color = rgbcolor
simpleMarkerSymbol.Outline = True
simpleMarkerSymbol.OutlineColor = rgbcolor 'outlineRGBColor
If SymbolSize = 0 Then
simpleMarkerSymbol.Size = 8
Else
simpleMarkerSymbol.Size = SymbolSize
End If
simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle
Dim markerElement As IMarkerElement
markerElement = New MarkerElement
markerElement.Symbol = simpleMarkerSymbol
elem = markerElement
End If
If g.GeometryType = esriGeometryType.esriGeometryPolyline Or g.GeometryType = esriGeometryType.esriGeometryLine Then
' Line elements
Dim simpleLineSymbol As ISimpleLineSymbol
simpleLineSymbol = New SimpleLineSymbol
'set COlors
rgbcolor.Blue = 0
rgbcolor.Red = 255
rgbcolor.Green = 0
simpleLineSymbol.Color = rgbcolor
simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid
If SymbolSize <> 0 Then
simpleLineSymbol.Width = SymbolSize
Else
simpleLineSymbol.Width = 2
End If
Dim le As ILineElement
le = New LineElement
le.Symbol = simpleLineSymbol
elem = le ' Explicit Cast
End If
If (g.GeometryType) = esriGeometryType.esriGeometryPolygon Then
' Polygon elements
Dim simpleFillSymbol As ISimpleFillSymbol
simpleFillSymbol = New SimpleFillSymbol
'set COlors
rgbcolor.Blue = 0
rgbcolor.Red = 0
rgbcolor.Green = 255
simpleFillSymbol.Color = rgbcolor
simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSForwardDiagonal
Dim fillShapeElement As IFillShapeElement
fillShapeElement = New PolygonElement
fillShapeElement.Symbol = simpleFillSymbol
elem = fillShapeElement
End If