Software Developer's Kit - ChemDraw

Send comments on this topic
Color Property
See Also 

Description

Member of ChemDraw Control.Style.

Sets and returns the color associated with this style.

Property type

Read-write property

Syntax

Visual Basic
Public Property Color() As ULong

Return Type

Ulong

Remarks

This property returns the color expressed as an unsigned long data type.

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)

Example

'Declares variable vStyle
 Dim vStyle As ChemDrawControl10Ctl.Style
 Set vStyle = ctlChemDraw.Styles.Item(1)
 Private Sub cmdColor_click()
    'Example 1: Returns the color of the selected Style
     Text1.text = vStyle.Color
    'Example 2: Turns to red the last Style selected
     For Each myStyle In Selection.Styles
         If  myStyle.Selected = True Then          
             Set vStyle = myStyle
             vStyle.Color = vbRed
         End If
     Next
    'Example 3: color is chosen from CommonDialog.Color (color palette)
     vStyle.Color = "&H" & Hex(CommonDialog.Color)
    'uses hex color definition:  CommonDialog.Color = "&H" & Hex(vStyle.Color)
 End Sub 

See Also