I am a self taught newbie (the worse sort) so please go gently.
My son has produce code to display and reorder jpeg thumbnails in a ListView and it works well, however, I would prefer Drop and Drag. I have sort of got it to work based on the example and a suggestion to remove 2 lines of code (see below) but it has 2 main problems. Note I am dragging within the same list (reordering) rather than dragging it somewhere else.
1/ Whenever I drop the thumbnail it always ends up at the bottom of the list.
2/ There is no indication where its about to be dropped.
Finally is there a way to display / bring into view an thumbnail image that has scrolled outside the window?
Private Sub ListViewDragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListView1.DragDrop, ListView1.DragDrop
Dim lvItem As ListViewItem
Dim destItem As ListViewItem
Dim destLv As ListView = CType(sender, ListView)
Dim clX As Integer = destLv.PointToClient(New Point(e.X, e.Y)).X
Dim clY As Integer = destLv.PointToClient(New Point(e.X, e.Y)).Y
If e.Data.GetDataPresent("System.Windows.Forms.ListViewItem", False) Then
'dragging a listview item
lvItem = CType(e.Data.GetData("System.Windows.Forms.ListViewItem"), ListViewItem)
'#' - destItem = CType(sender, ListView).GetItemAt(clX, clY)
'#' - destLv.Items.Insert(destItem.Index, lvItem.Clone)
lvItem.Remove()
destLv.Items.Add(lvItem)
End If
End Sub
Thanks in advance, Andrew