PageNumber Property
Returns the zero-based page number of the document in the viewer control on which the specified bounding rectangle appears. Read-only Long.
expression.PageNumber
*expression * Required. An expression that returns an MiSelectRect object.
Remarks
The TextSelection property of the viewer control returns the user's selection as text as an IMiSelectableItem object. The GetSelectRects method of the IMiSelectableItem object returns an MiSelectRects collection of MiSelectRect objects, or bounding rectangles, which surround the selected text. Each bounding rectangle exposes its coordinates in pixels (Top, Left, Bottom, and Right properties) as well as the page number (PageNumber property) of the document in the viewer control on which the rectangle appears.
Example
The following example displays the page number and coordinates of the bounding rectangles in the user's text selection in the viewer control.
Sub TestTextSelection()
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
Applies to | MiSelectRect Object