Software Developer's Kit - ChemDraw

Send comments on this topic
Top Property
See Also 

Description

Member of ChemDraw Control.Rect.

Sets and returns the top of this rectangle.

Property type

Read-write property

Syntax

Visual Basic
Public Property Top() As Double

Return Type

Double

Remarks

Top returns the coordinate to the top line of a rectangle, such as that bounding an object in ChemDraw. Top is expressed in points and when working on the same object, the value returned from bottom is equivalent:

TopLeft.Y or TopRight.Y * 20.

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
    Label2.Caption = "Rect coordinates that return values in IntermCoords" + 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