Formatting legends

558
0
11-27-2012 05:24 PM
GinoMellino
Occasional Contributor
Hi All,
I have tried to find posts about why this is happening but none have been able to help me. I have an automated mapping app which creates a legend on the fly. This all works fine until I try to use the code below to change the XOffset of the layer name text for layers which are symbolised with a UVR. The same code draws all items but the results in the actual legend seem to be random with different indents for different layers. Whats more, if I click the 'Draw' button in my app again it will recreate the legend differently although nothing has changed. Can anyone please help me either a. indent the layer name or b. indent the UVR patches beneath the layer name, I need to make it clear which patches below to layers with multiple symbologies. I am using VB.Net and ArcGIS 10 SP5.

Thanks in advance, any help is much appreciated.



If (TypeOf geofeaturelayer.Renderer Is IUniqueValueRenderer) Then
                    Dim pUVRend As IUniqueValueRenderer
                    pUVRend = geofeaturelayer.Renderer

                    For fldcount As Integer = pUVRend.FieldCount - 1 To 0 Step -1
                        For valcount As Integer = pUVRend.ValueCount - 1 To 0 Step -1
                            If UVRValueInMap(pUVRend.Field(fldcount), pUVRend.Value(valcount), pFeatureSelection) = False Then
                                pUVRend.RemoveValue(pUVRend.Value(valcount))
                            End If
                        Next
                    Next

                    'Setup font for layername and set the layer name visible in the legend
                    Dim newfont As IFontDisp = New StdFont
                    With newfont
                        .Bold = True
                        .Name = "Arial"
                        .Size = 10
                    End With

                    Dim textsymbol As ISimpleTextSymbol = New TextSymbol
                    With textsymbol
                        .Font = newfont
                        .XOffset = 10
                    End With

                    pLegendItem.LayerNameSymbol = textsymbol
                    pLegendItem.ShowLayerName = True
                End If
0 Kudos
0 Replies