ImageSelection Property
Returns the selected portion of the page displayed in the viewer control as an image. Read/write IMiSelectableImage.
expression.ImageSelection
*expression * Required. An expression that returns an MiDocView object.
Remarks
You can retrieve the user's selection in the viewer control as text (using the TextSelection property, which returns an IMiSelectableItem object) or as an image (using the ImageSelection property, which returns an IMiSelectableImage object). You can access the recognized text and the individual words of a text selection, and you can export an image selection as an IPictureDisp object for display in another control. Both text and image selections also support the CopyToClipboard method and a method that returns the coordinates of the selection.
The SelectionChanged event fires when the user makes a selection or changes the selection in the viewer control.
The TextSelection and ImageSelection properties raise a run-time error if nothing is selected in the viewer control.
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 TestImageSelection()
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 | MiDocView Object