Software Developer's Kit - ChemDraw

Send comments on this topic
Color Property
See Also 

Description

Member of ChemDraw Control.Group.

Sets and returns the color of this Group.

Property type

Read-write property

Syntax

Visual Basic
Public Property Color() As ULong

Return Type

ULong

Remarks

This property sets and returns the group color as an unsigned long data type. Color can be set and read from an object Group, or can be set and returned from each object of the group (see Example below).

Color can be read as a hexadecimal number, which is easier to interpret as a RGB (Red-Green-Blue) type of definition for color.
Example: Red is 0000FF hex (255 will be returned as a decimal value)
              Green is 00FF00 hex (65280 will be returned as a decimal value)
              Blue is 1FF0000 hex (6711680  will be returned as a decimal value)

To set the color, select an object and press right button mouse, and choose "color". ChemDraw works with an 8 color palette, which may be expanded by the user. 

Example

  

Dim myGroup As ChemDrawControl10Ctl.Group

Private Sub Chem_GotFocus()
    If  ChemDrawCtl.Objects.Groups >= 1 True
Then 
        'at least there is one group drawn
        
Set myGroup = ChemDrawCtl.Groups(1) 'loads the group to a group type variable 
        Text1.Text = myGroup.ID 'shows the Group´s ID 
        'group accepts color, but group cannot be seen  
       
myGroup.Color = vbRed 
    Else
        'there is no group in the document 

    
End If
End Sub

Private Sub cmdGroupColor_Click()
   'Colors red the objects within the group
    For  x = 1 To myGroup.Objects.Count 

         MyGroup.Obejcts.Item(x).Color = vbRed
    Next x
End Sub

See Also