Have you tried refreshing the TOC directly (contentsview)something like this:for i=0 to pMxDoc.contentsviewcount -1 pMxDoc.Contentsview(i).refresh()next
Hi,try to change the order of instructions :define the style before defining proprieties outline, outlinesize and outlinecolor, ...Dim pSym2 As ISimpleMarkerSymbolSet pSym2 = New SimpleMarkerSymbolpSym2.Color = pColor2pSym2.Style = esriSMSCirclepSym2.Outline = TruepSym2.OutlineSize = 0.4pSym2.OutlineColor = pColor3pSym2.size = 5pRender.Symbol(1) = pSym2
Sorry but we do not know how to fix this:I pass the code that applies symbolization a layer of points withClassBreaksRenderer and "Quantities" and mode "Graduated Colors" from a .NET aplication, but at the end of the process, No way to update the table of contents.If we use ArcMap, right click, properties on the layer and look at the symbolization form, ALL is perfect and if you click the OK button, all is well.We refresh contents with pMxDoc.UpdateContents()and the activeView withpMxDoc.ActiveView.Refresh()Someone could tell us where we fail?Code A is failing--------------------------------Dim pMxDoc As IMxDocumentDim pLayer As ILayerDim pGeoLayer As IGeoFeatureLayerDim pFLayer As IFeatureLayerDim pFClass As IFeatureClassDim pRender As IClassBreaksRendererDim pColor1 As IRgbColorDim pColor2 As IRgbColorDim pColor3 As IRgbColorDim i As Integer'Dim pSFSym1 As ISimpleFillSymbol, pSFSym2 As ISimpleFillSymbolDim pSFSym1 As ISimpleMarkerSymbol, pSFSym2 As ISimpleMarkerSymbolDim pUIProperties As IClassBreaksUIPropertiesDim pRendererPropPage As IRendererPropertyPageDim pHistogram As IHistogramDim ptableHistogram As ITableHistogramDim pTable As ITableDim pClassify As IClassifyDim classes() As DoubleDim dataValues() As Double, datafreq() As IntegerDim pUIProp As IClassBreaksUIPropertiesDim fLR As IFeatureRendererDim itemGal As IEnumStyleGalleryItemDim gallery As IStyleGalleryDim gallery2 As IEnumStyleGalleryItemDim nom As StringDim p1 As esriSimpleMarkerStylepMxDoc = m_pDocpLayer = pMxDoc.ActiveView.FocusMap.Layer(0)pFLayer = pLayerpFClass = pFLayer.FeatureClasspTable = pFLayer'ptableHistogram = New TableHistogram'ptableHistogram.Field = "Valor"'ptableHistogram.Table = pTable'pHistogram = ptableHistogram'pHistogram.GetHistogram(dataValues, datafreq)'pClassify = New NaturalBreaks'pClassify.SetHistogramData(dataValues, datafreq)pRender = New ClassBreaksRendererpRender.Field = "Valor"pRender.BreakCount = 2pRender.MinimumBreak = 0pRender.Break(0) = 249.9999pRender.Break(1) = 5000pUIProp = pRenderpUIProp.LowBreak(0) = 0pUIProp.LowBreak(1) = 250'pRender.Description(0) = "Cumple Legislación"'pRender.Description(0) = "Incumple Legislación"pRender.Label(0) = " < 250"pRender.Label(1) = " >= 250"pColor1 = New RgbColorClasspColor1.RGB = System.Drawing.ColorTranslator.ToWin32(Color.Green Yellow)pColor2 = New RgbColorClasspColor2.RGB = System.Drawing.ColorTranslator.ToWin32(Color.Red)pColor3 = New RgbColorClasspColor3.RGB = System.Drawing.ColorTranslator.ToWin32(Color.Black )Dim cc As IMarkerBackgroundpSFSym1 = New SimpleMarkerSymbolpSFSym1.Color = pColor1pSFSym1.OutlineSize = 0.4pSFSym1.OutlineColor = pColor3pSFSym1.Size = 5pSFSym1.Style = esriSimpleMarkerStyle.esriSMSSquarepRender.Symbol(0) = pSFSym1pSFSym2 = New SimpleMarkerSymbolpSFSym2.Color = pColor2pSFSym2.OutlineSize = 0.4pSFSym2.OutlineColor = pColor3pSFSym2.Size = 5pSFSym2.Style = esriSimpleMarkerStyle.esriSMSCirclepRender.Symbol(1) = pSFSym2pRendererPropPage = New GraduatedColorPropertyPagepGeoLayer = pFLayerpGeoLayer.RendererPropertyPageClassID = pRendererPropPage.ClassIDpGeoLayer.Renderer = pRenderpGeoLayer.DisplayField = "Valor"pGeoLayer.DisplayAnnotation = FalsepMxDoc.ActiveView.PartialRefresh(esriViewDrawPhase .esriViewGeography, pLayer, Nothing)pMxDoc.ActiveView.ContentsChanged()pMxDoc.UpdateContents()pMxDoc.ActiveView.Refresh()---------------------------------------------------------------Code B is running in VBA------------------------------------------------- Dim pMxDoc As IMxDocument Dim pFLayer As IGeoFeatureLayer Dim pFclass As IFeatureClass Dim pFeature As IFeature Dim pFCursor As IFeatureCursor Dim pRender As IClassBreaksRenderer Dim pTable As ITable Dim pGeoLayer As IGeoFeatureLayer Dim pColor1 As IRgbColor Dim pColor2 As IRgbColor Dim pColor3 As IRgbColor Dim pUIProperties As IClassBreaksUIProperties Set pMxDoc = Application.Document Set pFLayer = pMxDoc.ActiveView.FocusMap.Layer(0) Set pFclass = pFLayer.FeatureClass Set pFCursor = pFclass.Search(Nothing, False) Set pFeature = pFCursor.NextFeature Set pTable = pFclass Set pGeoLayer = pFLayer Set pRender = New ClassBreaksRenderer 'Set pClassifyGEN = New Quantile pRender.Field = "Valor" pRender.BreakCount = 2 pRender.MinimumBreak = 0 pRender.Break(0) = 249.9999 pRender.Break(1) = 5000 Set pUIProperties = pRender pUIProperties.LowBreak(0) = 0 pUIProperties.LowBreak(1) = 250 pRender.Label(0) = " < 250" pRender.Label(1) = " > 250" Set pColor1 = New RgbColor Set pColor2 = New RgbColor Set pColor3 = New RgbColor pColor1.Red = 0 pColor1.Green = 255 pColor1.Blue = 0 pColor2.Red = 255 pColor2.Green = 0 pColor2.Blue = 0 pColor3.Red = 0 pColor3.Green = 0 pColor3.Blue = 0 Dim pSym1 As ISimpleMarkerSymbol Set pSym1 = New SimpleMarkerSymbol pSym1.Color = pColor1 pSym1.Outline = True pSym1.OutlineSize = 0.4 pSym1.OutlineColor = pColor3 pSym1.Style = esriSMSCircle pSym1.size = 5 pRender.Symbol(0) = pSym1 Dim pSym2 As ISimpleMarkerSymbol Set pSym2 = New SimpleMarkerSymbol pSym2.Color = pColor2 pSym2.Outline = True pSym2.OutlineSize = 0.4 pSym2.OutlineColor = pColor3 pSym2.Style = esriSMSCircle pSym2.size = 5 pRender.Symbol(1) = pSym2 ' assign renderer to layer Set pGeoLayer.Renderer = pRender pMxDoc.UpdateContents pMxDoc.ActiveView.Refresh-------------------------------------------------We use v9.2Thanks in advanceQuim
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.