Software Developer's Kit - ChemDraw

Send comments on this topic
Deflate Method
See Also 
dx
dx is a double number which is the number of points (expressed in internal coordinates) to shrink in the x direction. 
dy
dy is a double number which is the number of points (expressed in internal coordinates) to shrink in the y direction. 

Description

Member of ChemDraw Control.Rect.

Reduces this rectangle.

Syntax

Visual Basic
Public Sub Deflate( _
   ByVal dx As Double, _
   ByVal dy As Double _
) 

Parameters

dx
dx is a double number which is the number of points (expressed in internal coordinates) to shrink in the x direction. 
dy
dy is a double number which is the number of points (expressed in internal coordinates) to shrink in the y direction. 

Return Type

Rect

Remarks

Deflate shrinks a rectangle by a specified number of points. Deflate adds half (dx,dy) to the left and top edges, and subtracts half (dx,dy) from the right and bottom edges. If the rectangle is bounding an object, this method does not modify the object.

Example

'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
'Loads the last object selected into the variable
 For Each myObject In Selection.Objects
     If  myObject.Selected = True Then
         Set vObject = myObject
     End If
 Next

 Private Sub cmdDeflate_Click()   
    'Example of Rect.Deflate
     Set Rect = vObject.Bounds
     X = InputBox("These values are verified:" + Chr$(13) + _
         "[Variable].Bounds.TopLeft.X" + Chr$(13) + _

         "[Variable].Bounds.BottomRight.X" + Chr(13) & Chr(13) + _
         "dx is expressed points = CurCoords * 20", _
         "DEFLATE - Please input value for dx", _

         Format(Val(vobject.Bounds.TopLeft.Y), "0.00"))
     Y = InputBox("These values are verified:" + Chr$(13) + _
         "[Variable].Bounds.TopLeft.Y" + Chr$(13) + _

         "[Variable].Bounds.BottomRight.Y" + Chr(13) & Chr(13) + _
         "dy is expressed in points = CurCoords * 20", _
         "DEFLATE - Please input value for dy", _

         Format(Val(vobject.Bounds.BottomRight.Y), "0.00")) Y
    'Applies the deflate method
     myRect.Deflate X, Y
    'Shows the coordinates of the deflated rectangle
     vMessage = MsgBox("Rectangle after DEFLATE" + _

                Chr(13) + "NEW.TopLeft.X: " & Format(myRect.TopLeft.X, "###.##") & _
                Chr(13) + "NEW.TopLeft.Y: " & Format(myRect.TopLeft.Y, "###.##") & _
                Chr(13) + "NEW.BottomRight.X: " & Format(myRect.BottomRight.X, "###.##") & _
                Chr(13) + "NEW.BottomRight.Y: " & Format(myRect.BottomRight.Y, "###.##"), _
                vbInformation + vbOKOnly, "Loaded in another rectangle variable") 
  
 End Sub           

See Also