codeconverter

Symbols are blank?

Discussion created by codeconverter on Mar 3, 2011
When I add a layer to the map, everything seems to be working except the Symbols that I add to the UniqueValueRenderer are not displayed.  The text appears fine but the icon is blank.  I can get them to appear by double clicking on the line (bringing up the layers properties) then going to the symbols tab and just selecting ok.  Not sure what I should be refreshing to get them to appear correctly initially.  (Hoping this is not some automation problem.)  The code is in VB.NET using ArcGIS 10.0.

I have the following code:
...
           Dim pMxDoc As IMxDocument = m_pApp.Document
           Dim pActiveView As ESRI.ArcGIS.Carto.IActiveView = pMxDoc.ActiveView
           Dim pMap As ESRI.ArcGIS.Carto.IMap = pActiveView.FocusMap

           Dim pFeatureLayer As ESRI.ArcGIS.Carto.IFeatureLayer = _
               DirectCast(pObjFact.Create("esriCarto.FeatureLayer"), IFeatureLayer)
            pFeatureLayer.FeatureClass = _
                       pFeatureWorkspace.OpenFeatureClass(filename)
...
            pMap.AddLayer(pFeatureLayer)

            Dim pUniqueValueRenderer As ESRI.ArcGIS.Carto.IUniqueValueRenderer = _
                           New ESRI.ArcGIS.Carto.UniqueValueRenderer

            pUniqueValueRenderer.FieldCount = 1
            pUniqueValueRenderer.Field(0) = "Processed"
            pUniqueValueRenderer.UseDefaultSymbol = False

            ' create a SimpleLineSymbol to be used as the UniqueValueRenderer's
            ' symbol outline property (a plain black line)
            Dim pFPOColor As ESRI.ArcGIS.Display.IRgbColor = _
                           New ESRI.ArcGIS.Display.RgbColor
            pFPOColor.RGB = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Black)

            Dim pFPOutline As ESRI.ArcGIS.Display.ILineSymbol = _
                           New ESRI.ArcGIS.Display.SimpleLineSymbol
            pFPOutline.Color = pFPOColor
            pFPOutline.Width = 1

            ' create a LineFillSymbol to be used as the UniqueValueRenderer's
            ' symbol property
            Dim pFPRed As ESRI.ArcGIS.Display.IRgbColor = _
                            New ESRI.ArcGIS.Display.RgbColor
            pFPRed.RGB = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red)

            Dim pFPSymbol_0 As ESRI.ArcGIS.Display.ILineFillSymbol = _
                            New ESRI.ArcGIS.Display.LineFillSymbol
            pFPSymbol_0.Angle = 45
            pFPSymbol_0.Color = pFPRed
            pFPSymbol_0.Outline = pFPOutline

            ' add the symbol to the Renderer
            pUniqueValueRenderer.AddValue("0", "", pFPSymbol_0)
            ' add the label to the Renderer
            pUniqueValueRenderer.Label("0") = "Not yet exploited"
            pUniqueValueRenderer.Symbol("0") = pFPSymbol_0

... Add more symbols and then
            pFeatureLayer.Renderer = pUniqueValueRenderer

            Dim pLegendInfo As ESRI.ArcGIS.Carto.ILegendInfo
            pLegendInfo = pFeatureLayer

            pLegendInfo.LegendGroup(0).Visible = True

            pActiveView.Refresh()
            pMxDoc.CurrentContentsView.Refresh(0)




Please help.

Outcomes