vb.net arcmap change map symbology of geodatabase annotation

01-22-2015 07:09 AM
Occasional Contributor

Hi all,

Hopefully I'm in the correct location for asking this question.  Now days I'm not sure with the new GeoNet structure.

Anyway, I'm trying to change the color of specific levels of annotation displayed on an ArcMap document with VB coding.  I can do this when the database source is a coverage.  However, I'm trying to make use of our Annotation stored in a file geodatabase and do the same thing.

I asked this question years ago, but it was never fully answered and I've yet to find one.

I can loop thru the map layers and find the needed level on the map, but I can't get to the proper interface to change the symbology.  Let me be clear, I'm not trying to change the database, just the symbology (ie color) shown on the map.

Here's what I have:

Public Sub Set_Pcl_Anno()

Dim pPclLayer As ILayer
Dim pCompLayer As ICompositeLayer

'Dim pAnno_Pcl As ICoverageAnnotationLayer2
Dim pAnno_Pcl As ILayer

Dim pMyFeatLayer As IFeatureLayer2
Dim pAnnoLyr As IAnnotationLayer

'================== Loop thru layers for desired Annotation Layer ===================
For i = 0 To pMap.LayerCount - 1
    Set pPclLayer = pMap.Layer(i)
    If pPclLayer.Name = "AnnoClrmn" Then
        Set pPclLayer = pMap.Layer(i)
       'Anno is in geodatabase with levels..........
        If TypeOf pPclLayer Is ICompositeLayer Then
            Set pCompLayer = pPclLayer
            For k = 0 To pCompLayer.Count - 1
                'Get the anno level to change symbology.........
                If pCompLayer.Layer(k).Name = "Pcl" Then
                   Set pAnno_Pcl = pCompLayer.Layer(k)  'Sets to ILayer correctly........
                    'PROBLEM starts here
                    ' Can't find a way to set the symbology of the selected geodatabase layer.
                    '  I tried setting to these Interfaces, but no luck....
                    'Set pMyFeatLayer = pCompLayer.Layer(k)  'Set as IFeatureLayer
                   ' Set pAnnoLyr = pCompLayer.Layer(k)      'Set as IAnnofeatureLayer
                    Exit For
                End If
            Next k
        End If
    End If
Next i

'     Set pAnno_Pcl.TextSymbol to some pre-defined Textsymbol
'     This worked when the pAnno_Pcl was a coverage and not a geodatabase.

'     Set pAnno_Pcl.TextSymbol = pBlkTextSymbol

End Sub

Am I that close????  Can anyone get the last bit of code???



0 Kudos
0 Replies