Software Developer's Kit - ChemDraw

Send comments on this topic
Captions Property
See Also 

Description

Member of ChemDraw Control.Group.

Returns the captions collection of this group.

Property type

Read-only property

Syntax

Visual Basic
Public Property Captions() As Captions

Return Type

Remarks

This property refers to the collection of captions which is within this Group. The members of this collection will be the captions in this Group. The properties associated with the collection are the following:

myGroup.Captions.Application       returns the application associated with the collection of captions
myGroup.Captions.Count              returns the number of captions in the collection of  captions
myGroup.Captions.Item(i)            returns one caption from the collection of captions 
myGroup.Captions.Parent             returns the parent of the  collection of captions

With Group.Captions.Item(i) all the caption properties are enabled for caption(i). This index starts with 1.

Example

'Captions collection of this Group 
 Dim MyGroup As ChemDrawControl10Ctl.Group
 Private Sub ChemDrawControl10Ctl_SelectionChanged(ByVal selection As ChemDrawControl10Ctl.IChemDrawSelection)
     If  ChemDrawControl10Ctl.Objects.Groups.Count = 1 Then 'Checks if a Group has been drawn
         Set MyGroup = ChemDrawControl10Ctl.Groups.Captions.Item(1)
         Command1.Enabled = True
     Else
         Command1.Enabled = False
     End If 
 End Sub
 Private Sub Command1_Click()
     MyGroup.Caption.Angle = Val(Text1.Text)
     Text1.Text = MyGroup.Captions.Item(1).Angle 'reads the caption angle
     vMessage = InputBox("Change the Text", "[Variable].Caption.text", MyGroup.Captions.Item(1).Text)
     MyGroup.Captions.Item(1).Text = vMessage 'changes the Title of the caption
     MyGroup.Captions.Item(1).Color = &HFF '&HFF is red in hex
     MyGroup.Captions.Item(1).Color = vbBlue 'this is blue in VB code
 End Sub
 Private Sub Command1_Click()
     vMessage = MsgBox("The group has " & myGroup.Captions.Count & " Caption/s", _
                vbInformation + vbOKOnly, "Info")
 End Sub


See Also