Working with 'DynPicture' objects
Here are two samples, one to create a picture with default elements and the second to enumerate pictures of a project...
Sub CreatePicture()
Dim zPIC As DynPicture
Const PictureName As String = "Alarm-Picture"
Const TemplateName As String = "MAIN"
'check if Picture already exists...
Set zPIC = MyWorkspace.ActiveDocument.DynPictures.Item(PictureName)
If zPIC Is Nothing Then
'create new picture if not existing...
Set zPIC = MyWorkspace.ActiveDocument.DynPictures.Create(PictureName, TemplateName, tpAML)
'set the backcolor and create Default MDI Elements
With zPIC
.BackColor = vbRed
.CreateMdiDefaultElements
End With
End If
End Sub
Sub PictureList()
Dim i, n As Integer
Dim zProject As Project
Dim zPicture As DynPicture
'use this in VBA at zenOn Runtime...
'Set zProject = thisproject
'or use this in the zenOn Editor...
Set zProject = MyWorkspace.ActiveDocument
'run trough all pictures of the project...
For i = 0 To zProject.DynPictures.Count - 1
Set zPicture = zProject.DynPictures.Item(i)
Debug.Print zPicture.Name
'get count of elements within the actual picture
Debug.Print zPicture.Elements.Count & " Elements in this Picture..."
Next i
End Sub
This is a migrated post! Originally posted on 16.08.2007 by user robertf. Please be aware that information can be outdated.