Software Developer's Kit - ChemDraw

Send comments on this topic
Bounds Property
See Also 

Description

Member of ChemDraw Control.Spline.

Returns the rectangle of this Spline.

Property type

Read-only property

Syntax

Visual Basic
Public Property Bounds() As Rect

Return Type

Remarks

The bounds property refers to the smallest rectangle that encloses the graphical representation of an object. The properties and methods available for the bounds property are derived from the Rect object.

Example

'Declares variable vObject
'Object can be any ChemDraw object
 Dim vObject As ChemDrawControl10Ctl.Object
'Checks that there is an object loaded in the variable
 If  Selection.Objects.Count < 1 Then
     Exit Sub
 End If

 Private Sub cmdBounds_click()
    'Example 1: Returns distance to the left/right side of the rectangle  
     Text1.text = vObject.Bounds.Left
     Text1.text = vObject.Bounds.Right
    'Example 2: Returns the distance to the bottom/top side of the rectangle 
     Text2.text = vObject.Bounds.Bottom
     Text2.text = vObject.Bounds.Top
    'Example 3: Returns the coordinates from top left corner of the rectangle 
     Text3.text = vObject.Bounds.TopLeft.X
     Text3.text = vObject.Bounds.TopLeft.Y
    'Example 4: Returns the coordinates from bottom right corner of the rectangle 
     Text4.text = vObject.Bounds.BottomRight.X
     Text4.text = vObject.Bounds.BottomRight.Y
    'Example 5: Returns the coordinates from the center of the rectangle 
     Text5.text = vObject.Bounds.Center.X
     Text5.text = vObject.Bounds.Center.Y
    'Example 6: RECTANGLE properties  Declares a variable as a rectangle
     Dim MyRect As ChemDrawControl10Ctl.Rect
     Set MyRect = vObject.Bounds
    'Shows the rectangle coordinates 
     Label1.Caption = "MyRect TopLeft " + Chr$(13) + _
            Format(MyRect.TopLeft.X, "0.0") + "  " + _
            Format(MyRect.TopLeft.Y, "0.0") + Chr$(13) + _
            Format(MyRect.BottomRight.X, "0.0") + "  " + _
            Format(MyRect.BottomRight.Y, "0.0") + Chr$(13)
    'Rect shows this change - Object remains the same --> Bounds is Read Only
     MyRect.Inflate 100, 500
 End Sub 

See Also