public int DragEnter(IntPtr pDataObj, NativeShellAPI.MK grfKeyState, NativeShellAPI.POINT pt, ref DragDropEffects pdwEffect) { mouseButtons = grfKeyState; startEffects = pdwEffect; br.FileView.Focus(); br.SelectionChange = false; ReleaseCom(); dropDataObject = pDataObj; #region Get DropItem Point point = br.FileView.PointToClient(new Point(pt.x, pt.y)); ListViewHitTestInfo hitTest = br.FileView.HitTest(point); if (hitTest.Item != null && (br.FileView.View != View.Details || hitTest.SubItem == null || hitTest.Item.Name == hitTest.SubItem.Name) && (hitTest.Location == ListViewHitTestLocations.Image || hitTest.Location == ListViewHitTestLocations.Label || hitTest.Location == ListViewHitTestLocations.StateImage)) { dropListItem = hitTest.Item; wasSelected = dropListItem.Selected; dropListItem.Selected = true; ShellItem item = (ShellItem)dropListItem.Tag; parentDropItem = item; ShellHelper.GetIDropTarget(item, out dropTargetPtr, out dropTarget); } else { dropListItem = null; parentDropItem = br.CurrentDirectory; ShellHelper.GetIDropTarget(br.CurrentDirectory, out dropTargetPtr, out dropTarget); } #endregion if (dropTarget != null) { dropTarget.DragEnter(pDataObj, grfKeyState, pt, ref pdwEffect); } if (dropHelper != null) { dropHelper.DragEnter(br.Handle, pDataObj, ref pt, pdwEffect); } return(NativeShellAPI.S_OK); }
public int DragEnter(IntPtr pDataObj, NativeShellAPI.MK grfKeyState, NativeShellAPI.POINT pt, ref DragDropEffects pdwEffect) { mouseButtons = grfKeyState; br.FolderView.Focus(); br.SelectionChange = false; lastSelectedNode = br.FolderView.SelectedNode; ReleaseCom(); dropDataObject = pDataObj; #region Get DropItem Point point = br.FolderView.PointToClient(new Point(pt.x, pt.y)); TreeViewHitTestInfo hitTest = br.FolderView.HitTest(point); dropNode = hitTest.Node; br.FolderView.SelectedNode = dropNode; if (dropNode != null) { ShellItem item = (ShellItem)dropNode.Tag; parentDropItem = item; if (ShellHelper.GetIDropTarget(item, out dropTargetPtr, out dropTarget)) { dropTarget.DragEnter(pDataObj, grfKeyState, pt, ref pdwEffect); } } #endregion if (dropHelper != null) { dropHelper.DragEnter(br.Handle, pDataObj, ref pt, pdwEffect); } return(NativeShellAPI.S_OK); }