Early days yet, but try this:
Private Sub TVClasCode_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As stdole.OLE_XPOS_PIXELS, ByVal y As stdole.OLE_YPOS_PIXELS)
'Gestion de l'icône de la souris et des images du Treeview pendant un Drag & Drop
With BDGestCode
If Button = 1 Then
Debug.Print x, y
If Not .TVClasCode.HitTest(x * 15, y * 15) Is Nothing Then
If ClefDrag Like "Cat*" Or .TVClasCode.HitTest(x * 15, y * 15).Key = "Cat0" Or Not BoolEnableDrag Then
.TVClasCode.MousePointer = ccNoDrop
BoolDrag = False
Else
BoolDrag = True
If Shift = 2 Then
BoolCopy = True
.TVClasCode.Nodes(ClefDrag).Image = IIf(TypDrag = "G", 6, 7)
End If
.TVClasCode.MousePointer = ccCustom
.TVClasCode.MouseIcon = .TVClasCode.Nodes(ClefDrag).CreateDragImage
End If
Set .TVClasCode.DropHighlight = .TVClasCode.HitTest(x * 15, y * 15)
If Not .TVClasCode.DropHighlight.Expanded Then .TVClasCode.DropHighlight.Expanded = True
.TVClasCode.Nodes(Application.Min(.TVClasCode.DropHighlight.Index + 1, TVClasCode.Nodes.Count)).EnsureVisible
.TVClasCode.Nodes(Application.Max(1, .TVClasCode.DropHighlight.Index - 1)).EnsureVisible
End If
Else
Set .TVClasCode.DropHighlight = Nothing
.TVClasCode.MousePointer = ccDefault
Set .TVClasCode.MouseIcon = Nothing
BoolDrag = False
End If
End With
End Sub
same code below but am able to highlight the added lines:
Private Sub TVClasCode_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As stdole.OLE_XPOS_PIXELS, ByVal y As stdole.OLE_YPOS_PIXELS)
'Gestion de l'icône de la souris et des images du Treeview pendant un Drag & Drop
With BDGestCode
If Button = 1 Then
Debug.Print x, y
If Not .TVClasCode.HitTest(x * 15, y * 15) Is Nothing Then
If ClefDrag Like "Cat*" Or .TVClasCode.HitTest(x * 15, y * 15).Key = "Cat0" Or Not BoolEnableDrag Then
.TVClasCode.MousePointer = ccNoDrop
BoolDrag = False
Else
BoolDrag = True
If Shift = 2 Then
BoolCopy = True
.TVClasCode.Nodes(ClefDrag).Image = IIf(TypDrag = "G", 6, 7)
End If
.TVClasCode.MousePointer = ccCustom
.TVClasCode.MouseIcon = .TVClasCode.Nodes(ClefDrag).CreateDragImage
End If
Set .TVClasCode.DropHighlight = .TVClasCode.HitTest(x * 15, y * 15)
If Not .TVClasCode.DropHighlight.Expanded Then .TVClasCode.DropHighlight.Expanded = True
.TVClasCode.Nodes(Application.Min(.TVClasCode.DropHighlight.Index + 1, TVClasCode.Nodes.Count)).EnsureVisible
.TVClasCode.Nodes(Application.Max(1, .TVClasCode.DropHighlight.Index - 1)).EnsureVisible
End If
Else
Set .TVClasCode.DropHighlight = Nothing
.TVClasCode.MousePointer = ccDefault
Set .TVClasCode.MouseIcon = Nothing
BoolDrag = False
End If
End With
End Sub