MiSelectRects Collection Object
MiSelectRects MiSelectRect |
Represents the collection of bounding rectangles in the user's text selection in the viewer control. A collection of MiSelectRect objects.
Using the MiSelectRects Collection
You can retrieve the user's selection in the viewer control as text using the viewer's TextSelection property, which returns an IMiSelectableItem object. Use the GetSelectRects method of the IMiSelectableItem object to return an MiSelectRects collection of the bounding rectangles in the user's text selection in the viewer control. Each MiSelectRect object exposes its coordinates (Top, Left, Bottom, and Right properties) as well as the page number (PageNumber property) on which it appears.
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 coordinates of each bounding rectangle in the user's text selection in the viewer control.
Sub TestSelectRects()
Dim miTextSel As MODI.IMiSelectableItem
Dim miSelectRects As MODI.miSelectRects
Dim miSelectRect As MODI.miSelectRect
Dim strTextSelInfo As String
Set miTextSel = MiDocView1.TextSelection
Set miSelectRects = miTextSel.GetSelectRects
strTextSelInfo = _
"Bounding rectangle page & coordinates: " & vbCrLf
For Each miSelectRect In miSelectRects
With miSelectRect
strTextSelInfo = strTextSelInfo & _
.PageNumber & ", " & .Top & ", " & _
.Left & ", " & .Bottom & ", " & _
.Right & vbCrLf
End With
Next
MsgBox strTextSelInfo, vbInformation + vbOKOnly, _
"Text Selection Info"
Set miSelectRect = Nothing
Set miSelectRects = Nothing
Set miTextSel = Nothing
End Sub
Properties | Count Property | Item Property
Parent Objects
Child Objects