GetBoundingRect Method

Returns the page number and the coordinates of the bounding rectangle around the user's image selection in the viewer control.

expression.GetBoundingRect(plPageNum, Left, Top, Right, Bottom)

*expression   * Required. An expression that returns an IMiSelectableImage object.

plPageNum    Required Long. A long integer variable that returns the zero-based page number on which the bounding rectangle appears.

*Left   * Required Long. Specifies the distance in pixels from the left edge of the containing image to the left edge of the rectangle.

*Top   * Required Long. Specifies the distance in pixels from the top edge of the containing image to the top edge of the rectangle.

*Right   * Required Long. Specifies the distance in pixels from the left edge of the containing image to the right edge of the rectangle.

*Bottom   * Required Long. Specifies the distance in pixels from the top edge of the containing image to the bottom edge of the rectangle.

Remarks

You can retrieve the user's selection in the viewer control as an image using the viewer's ImageSelection property, which returns an IMiSelectableImage object. Use the GetBoundingRect method of the IMiSelectableImage object to fill in variables that return the coordinates (in the Left, Top, Right, and Bottom arguments) of the bounding rectangle from the user's image selection in the viewer control, as well as the page number (in the plPageNum argument) of the document in the viewer that the rectangle appears on.

All of the rectangle objects and properties in the Microsoft Office Document Imaging 2003 object model work as follows:

  • The Top and Bottom properties represent the distance in pixels from the top edge of the containing image.
  • The Left and Right properties represent the distance in pixels from the left edge of the containing image.

Example

The following example reports the page number and the coordinates of the bounding rectangle around the user's image selection in the viewer control.

Sub TestGetBoundingRect()

  Dim miImageSel As MODI.IMiSelectableImage
  Dim lngPageNo As Long
  Dim lngLeft As Long, lngTop As Long
  Dim lngRight As Long, lngBottom As Long
  Dim strImageSelInfo As String
  
  Set miImageSel = MiDocView1.ImageSelection
  miImageSel.GetBoundingRect lngPageNo, _
   lngLeft, lngTop, lngRight, lngBottom
  
  strImageSelInfo = _
    "Page number: " & lngPageNo & vbCrLf & _
    "Bounding rectangle coordinates: " & vbCrLf & _
    lngLeft & ", " & lngTop & ", " & _
    lngRight & ", " & lngBottom
  MsgBox strImageSelInfo, vbInformation + vbOKOnly, _
    "Image Selection Info"
  
  Set miImageSel = Nothing

End Sub

Applies to | IMiSelectableImage Object