Amit,
I investigated more about this issue and found something that might help.
Please change your code as follows and retry using the custom annotation object:
+---------------------------------+
Private Sub RasterAnn_OnAnnMouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
'Maen code
If hLine1 <> 0 Then
Dim nHit
nHit = RasterAnn.AnnHitTest(RasterAnn.AnnContainer, x, y)
If nHit = 2 Then 'a handle
RasterAnn.AnnSetSelected hLine1, False, False
RasterAnn.AnnSetSelected hLine2, False, False
RasterAnn.AnnSetSelected hLine3, False, False
RasterAnn.AnnSetSelected RasterAnn.AnnHitTestObject, True, False
Else
RasterAnn.AnnSetSelected hLine1, True, False
RasterAnn.AnnSetSelected hLine2, True, False
RasterAnn.AnnSetSelected hLine3, True, False
End If
End If
' end Maen code
x0 = x
y0 = y
If selfeature = "Custom" Then
Select Case RasterAnn.AnnTool
Case ANN_TOOL_USER_FIRST
' create the objects
RasterAnn.AnnSetSelected RasterAnn.AnnContainer, False, True
'Add an undo node to undo the creation of these objects.
RasterAnn.AnnAddUndoNode
RasterAnn.AnnCreate ANN_OBJECT_LINE, True, True
hLine1 = RasterAnn.AnnObject
RasterAnn.AnnCreate ANN_OBJECT_LINE, True, True
hLine2 = RasterAnn.AnnObject
RasterAnn.AnnCreate ANN_OBJECT_LINE, True, True
hLine3 = RasterAnn.AnnObject
oldx = x
oldy = y
' set the automation defaults to the objects newly created
RasterAnn.AnnSetAutoDefaults hLine1, 0
RasterAnn.AnnSetAutoDefaults hLine2, 0
RasterAnn.AnnSetAutoDefaults hLine3, 0
' start defining them from the x, y coordinate
RasterAnn.AnnDefine hLine1, x, y, ANN_DEFINE_BEGINSET
RasterAnn.AnnDefine hLine2, x, y + 50, ANN_DEFINE_BEGINSET
RasterAnn.AnnDefine hLine3, x, y, ANN_DEFINE_BEGINSET
End Select
End If
End Sub
...
Private Sub RasterAnn_OnAnnMouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
If selfeature = "Custom" Then
Select Case RasterAnn.AnnTool
Case ANN_TOOL_USER_FIRST
RasterAnn.AnnDefine hLine1, x, y, ANN_DEFINE_END
RasterAnn.AnnDefine hLine2, x, y + 50, ANN_DEFINE_END
RasterAnn.AnnDefine hLine3, (oldx + x) / 2, oldy, ANN_DEFINE_BEGINSET
RasterAnn.AnnDefine hLine3, (oldx + x) / 2, y + 50, ANN_DEFINE_END
RasterAnn.AnnSetSelected hLine1, True, False
RasterAnn.AnnSetSelected hLine2, True, False
RasterAnn.AnnSetSelected hLine3, True, False
'Maen RasterAnn.AnnGroup RasterAnn.AnnContainer, ANN_FLAG_RECURSE + ANN_FLAG_SELECTED, ""
'Maen hLine3 = 0
'Maen hLine2 = 0
'Maen hLine1 = 0
Case ANN_TOOL_RECT
AdjustMousePos Shift, x, y
End Select
selfeature = ""
End If
RasterAnn.AnnTool = ANN_TOOL_SELECT
End Sub
...
+---------------------------------+
Thanks,
Maen Badwan
LEADTOOLS Technical Support