Wednesday, December 10, 2008

copy render symbology

Sub CopyRenderer()
Dim pMxDoc As IMxDocument
Dim pMap As IMap
Set pMxDoc = Application.Document
Set pMap = pMxDoc.FocusMap

Dim pLayer1 As IGeoFeatureLayer
Dim pLayer2 As IGeoFeatureLayer

Set pLayer1 = pMap.layer(0)
Set pLayer2 = pMap.layer(1)

Dim pObjectCopy As IObjectCopy
Set pObjectCopy = New ObjectCopy

Set pLayer2.Renderer = pObjectCopy.Copy(pLayer1.Renderer)

Dim hx As IRendererPropertyPage
Set hx = New CombiUniqueValuePropertyPage
pLayer2.RendererPropertyPageClassID = hx.ClassID

pMxDoc.ActiveView.ContentsChanged
pMxDoc.UpdateContents
pMxDoc.ActiveView.Refresh

End Sub

No comments: