MarkSelect Example VB

In this example, when the MarkSelect event fires, the MarkLeft and MarkTop global variables are assigned the Left and Top coordinates of the selected annotation.

Then, the EditSelectedAnnotationText method in the cmdEditText_Click event procedure, permits the user to edit the text of the selected annotation.

Private Sub ImgEdit1_MarkSelect(ByVal Button As Integer, ByVal Shift As Integer,
 ByVal Left As Long, ByVal Top As Long, ByVal Width As Long,
 ByVal Height As Long, ByVal MarkType As Integer,
 ByVal GroupName As String)
   'Dimension MarkLeft and MarkTop as global variables so these
   'values can be passed back to the EditSelectedAnnotationText method
    MarkLeft = Left
    MarkTop = Top
End Sub

Private Sub cmdEditText_Click()
    'This would allow the user to edit the text of an existing
    'selected annotation mark
   
    On Error GoTo HandleIt
    'Coordinates of the mark are obtained from the MarkSelect
    'event (see code above).
    ImgEdit1.EditSelectedAnnotationText MarkLeft, MarkTop
    
    Exit Sub
     
HandleIt:
    'Handle error if no mark is selected or the wrong type
    'of mark is selected
     MsgBox Err.Description
End Sub