Software Developer's Kit - ChemDraw

Send comments on this topic
TopLeft Property
See Also 

Description

Member of ChemDraw Control.Rect.

Sets and returns the coordinates of the top left point of this rectangle.

Property type

Read-write property

Syntax

Visual Basic
Public Property TopLeft() As Point

Return Type

Remarks

TopLeft works with the (x,y or z) coordinate of the top left point of a rectangle. When working on the same rectangle, the value returned from: 

TopLeft.X is equivalent to the value returned from Left divided by 20.
TopLeft.Y is equivalent to the value returned from Top divided by 20.
TopLeft.Z = 0 when working in two dimensions.  

The TopLeft value is expressed as CurCoords.

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)

     'Applies the IsEmpty property:Returns False if Rect contains an object
    Text1.Text = myRect.IsEmpty
End Sub

See Also