a00578107

How do I change color of annotation through code?

Discussion created by a00578107 on May 26, 2010
Latest reply on May 26, 2010 by a00578107
Hello Fellow-Forum-ers!

I have an application that loads a whole bunch of layers, some of which are SDE annotation layers.  I cannot figure out how to change the symbology of the annotation, namely color (but also size).  For simplicity sake and for testing I am working with only one layer in a new, separate document and have included my code below for bringing in the annotation layer.  While this differs from my actual application this serves its purpose for trouble-shooting. 

So my question is - how do I change the color that this annotation layer loads in?

Any help pointing me in the right direction would be appreicated as I am definitely stumped.  Thanks so much!


Private Function MxDocument_OPENDOCUMENT() As Boolean

Dim pPropset As IPropertySet
Set pPropset = New PropertySet
With pPropset
.SetProperty "Server", "*****"
.SetProperty "Instance", "*****"
.SetProperty "user", "*****"
.SetProperty "password", "*****"
.SetProperty "version", "*****"
End With

Dim pworkspacename As IWorkspaceName
Set pworkspacename = New WorkspaceName
pworkspacename.WorkspaceFactoryProgID = "esricore.SdeWorkspaceFactory"
pworkspacename.ConnectionProperties = pPropset

Dim pdatasetName As IDatasetName
Set pdatasetName = New FeatureClassName

pdatasetName.Name = "chwksde.dbo.SS_SansymAnno"
Set pdatasetName.WorkspaceName = pworkspacename

Dim pname As IName
Set pname = pdatasetName

Dim ptable As ITable
Set ptable = pname.Open

Dim pfeatclass As IDataset
Set pfeatclass = ptable

Dim pfeatlay As IFeatureLayer
Dim pFDOGraphicsLayerFactory As IFDOGraphicsLayerFactory
Set pFDOGraphicsLayerFactory = New FDOGraphicsLayerFactory
Set pfeatlay = pFDOGraphicsLayerFactory.OpenGraphicsLayer(pfeatclass.Workspace, Nothing, "chwksde.dbo.SS_SansymAnno")

pfeatlay.Name = pfeatclass.Name

Dim pmap As IMap
Dim pmxdoc As IMxDocument

Set pmxdoc = ThisDocument
Set pmap = pmxdoc.ActiveView

pmap.AddLayer pfeatlay

Dim pav As IActiveView
Set pav = pmap

pav.Refresh

End Function

Outcomes