Elements

 

Remarks Properties Methods Samples

ED
avaliable
RT
avaliable

Remarks:Top

This collection contains the defined dynamic elements of a picture.
The single dynamic elements contain the most important properties, e.g. type, position, colour, ...

The single dynamic elements can be found in the collection by their unique name or by the index.

Hint for older Versions:
Giving a name to a dynamic element is optional.
If a dynamic element has no name, it is not found under certain circumstances.
So the result of the method Item should always be checked on Nothing.

Properties:Top

Count Parent  

Methods:Top

Create Delete Item

Samples:Top

'##########################################################
'## A Procedure to create a new textbutton in a picture. ##
'## Several properties will be set and a function linked ##
'##########################################################
Sub CreateElement()
	Dim zPIC As DynPicture
	Dim zELE As Element
	Const strPicture As String = "PictureName"
	Const strElement As String = "ElementName"
	Const strFunction As String = "FunctionName"
	'get Picture object
	Set zPIC = MyWorkspace.ActiveDocument.DynPictures.Item(strPicture)
	'if picture object is nothing, the picture doesn't exist...
	If zPIC Is Nothing Then Exit Sub
	'get Element object
	Set zELE = zPIC.Elements.Item(strElement)
	'if element object is nothing, a new one can be created...
	If zELE Is Nothing Then
		'create a new element (Text-Button)
		Set zELE = zPIC.Elements.Create(strElement, tpDynButton)
		'set properties of the new element
		With zELE
		'set size and position
		.Left = 100
		.Top = 100
		.Width = 150
		.Height = 50
		'set graphic representation
		.BackColor = vbBlue
		.ForeColor = vbWhite
		.DynProperties("BtnStyle3D") = True
		.DynProperties("BtnStyleFill") = 2
		.DynProperties("BtnStyleBorder") = 0
		.DynProperties("Text1") = "New TextButton"
		.DynProperties("Text2") = "(created by VBA)"
		'link a function
		.DynProperties("Function") = strFunction
		End With
	End If
End Sub