Problem with treeview drag and drop
-
I have a TreeView control within the main form. The main form processes the normal drag/drop event processing. The drag/drop operation performs successfully except for this little problem. When I do a DoDragDrop() operation within the TreeView, when dragging the mouse 'within' the TreeView, the main form receives drag drop events. I only want the 'main form' events when the mouse is within the main form client area. What have I missed? Thanks Private Sub FolderTree_Drag(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ItemDragEventArgs) Handles MyBase.ItemDrag If e.Button = Windows.Forms.MouseButtons.Left Then Dim node As TreeNode = CType(e.Item, TreeNode) Dim dataObject As New DataObject() Dim sFiles As New StringCollection sFiles.Add(node.FullPath) dataObject.SetData(ConstDragDropFormat, sFiles) ' Invoke the drag and drop operation DoDragDrop(dataObject, DragDropEffects.Copy) End If End Sub I have tried this code in the TreeView but it does not help. Private Sub TreeView_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragEnter e.Effect = DragDropEffects.None End Sub Private Sub TreeView_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragDrop e.Effect = DragDropEffects.None End Sub Private Sub TreeView_DragOver(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragOver e.Effect = DragDropEffects.None End Sub