In old vb6.0 it was easy to highlight the target item, where to drop those dragged rows.
Private Sub listView_OLEDragOver(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single, State As Integer)
Set listView.DropHighlight = listView.HitTest(x, y)
I have been Googling all day to find out, how to do that in VB.NET (
and I wasn't the only one without an proper answer).
You can get the item to drop to in VB.NET:
Private Sub ListView_DragDrop(ByVal sender As Object, ByVal _
e As System.Windows.Forms.DragEventArgs) Handles _
ListView.DragDrop
Dim lvw As ListView = DirectCast(sender, ListView)
Dim dragged_items As List(Of ListViewItem) = _
e.Data.GetData("System.Collections.Generic.List(Of " & _
"System.Windows.Forms.ListViewItem)")
Dim pt As Point = lvw.PointToClient(New Point(e.X, e.Y))
Dim lvi As ListViewItem = lvw.GetItemAt(pt.X, pt.Y)
Dim index As Integer
If lvi IsNot Nothing Then
index = lvi.Index
End If
Dim hti As ListViewHitTestInfo = lvw.HitTest(pt.X, pt.Y)
If (hti.Item Is Nothing) Then Return
Dim item As ListViewItem = hti.Item
Now we got the index and item, where to drop. But then what? One possibility to do the HighLight is change the ListViews state to "LVIS_DROPHILITED" by sending Windows message "SendMessageA(lvw.Handle, LVIS_DROPHILITED, 0, 0)". But when is the right time to do that (DragEnter or DragDrop event) and what are the right parameters? Didn't succeed on that yet. I appreciate any kind of help???