Software Developer's Kit - ChemDraw

Send comments on this topic
Rect Object
See Also  Members 

Description

Member of ChemDraw Control.            

For a list of all members defined for this object, see Rect Members.

ChemDraw Rectangle Class represents a rect object.

Object Model






Remarks

The rect object properties and methods refer to a rectangle, such as that bounding an object. When applied to the rectangle bounding an object, they can retrieve the value for the rectangle of the object, but they do not modify the rectangle bounding the object nor do they modify the object. 

Example

'This example illustrates the use of Rect Properties 
'Declares the variables

 Dim myObject As ChemDrawControl10Ctl.Object
 Dim vObject  As ChemDrawControl10Ctl.Object 
 Dim myRect   As ChemDrawControl10Ctl.Rect
'Checks that there is an object loaded in the variable
 If  Selection.Objects.Count < 1 Then 
     Exit Sub
 End If

'Works with one object (could be any ChemDraw object)
 For Each myObject In Selection.Objects
     If  myObject.Selected = True Then
         Set
vObject = myObject
     End If
 Next
 
Private Sub cmdRectProperties_Click()
     Set myRect = vObject.Bounds  
    'Shows the properties of Rect - using the rectangle that bounds an object
     Label1.Caption = "Rect coordinates that return values in CurCoords" + Chr$(13) + _
                  Format(myRect.BottomLeft.X,  "0.0") + "  "     + _
                  Format(myRect.BottomLeft.Y,  "0.0") + Chr$(13) + _
                  Format(myRect.BottomRight.X, "0.0") + "  "     + _
                  Format(myRect.BottomRight.Y, "0.0") + Chr$(13) + _ 
                  Format(myRect.Center.X,      "0.0") + "  "     + _
                  Format(myRect.Center.Y,      "0.0") + Chr$(13) + _
                  Format(myRect.TopLeft.X,     "0.0") + "  "     + _
                  Format(myRect.TopLeft.Y,     "0.0") + Chr$(13) + _
                  Format(myRect.TopRight.X,    "0.0") + "  "     + _
                  Format(myRect.TopRight.Y,    "0.0") + Chr$(13) 

     Label2.Caption = "Rect coordinates that return values in InternCoords" + Chr$(13) + _
                  Format(myRect.Bottom, "0.0") + Chr$(13) + _
                  Format(myRect.Height, "0.0") + Chr$(13) + _
                  Format(myRect.Left, "0.0")   + Chr$(13) + _
                  Format(myRect.Right, "0.0")  + Chr$(13) + _
                  Format(myRect.Top, "0.0")    + Chr$(13) + _
                  Format(myRect.Width, "0.0")  + Chr$(13)
    'Applies the IsEmpty property: Returns False if Rect contains an object  
     Text1.Text = myRect.IsEmpty 
 End Sub

See Also