public void DragMove(IDragDropToTabWindow dragWin) { if (dragWin == null) { return; } Win32Helper.Win32Point p = new Win32Helper.Win32Point(); if (!Win32Helper.GetCursorPos(ref p)) { return; } Point dragWinPosition = new Point(p.X, p.Y); foreach (IDragDropToTabWindow existWin in _allWindows) { if (dragWin.Equals(existWin)) { continue; } if (existWin.IsDragMouseOver(dragWinPosition)) { if (!_dragEnteredWindows.Contains(existWin)) { _dragEnteredWindows.Add(existWin); } } else { if (_dragEnteredWindows.Contains(existWin)) { _dragEnteredWindows.Remove(existWin); existWin.OnDrageLeave(); } } } if (_dragEnteredWindows.Count > 0) { IntPtr dragWinHwnd = new System.Windows.Interop.WindowInteropHelper((Window)dragWin).Handle; IntPtr dragBelowhwnd = Win32Helper.GetWindow(dragWinHwnd, Win32Helper.GW_HWNDNEXT); IDragDropToTabWindow nextTopWin = null; bool foundTabTarget = false; for (IntPtr hWind = dragBelowhwnd; hWind != IntPtr.Zero; hWind = Win32Helper.GetWindow(hWind, Win32Helper.GW_HWNDNEXT)) { foreach (Window enteredWin in _dragEnteredWindows) { IntPtr enterWinHwnd = new System.Windows.Interop.WindowInteropHelper(enteredWin).Handle; if (hWind == enterWinHwnd) { nextTopWin = (IDragDropToTabWindow)enteredWin; ((IDragDropToTabWindow)enteredWin).OnDragEnter(); foundTabTarget = true; break; } } if (foundTabTarget) { break; } } if (nextTopWin != null) { foreach (Window enteredWin in _dragEnteredWindows) { if (!nextTopWin.Equals(enteredWin)) { ((IDragDropToTabWindow)enteredWin).OnDrageLeave(); } } if (nextTopWin.IsDragMouseOverTabZone(dragWinPosition)) { ((Window)dragWin).Hide(); } else { ((Window)dragWin).Show(); } } } else { if (!((Window)dragWin).IsVisible) { ((Window)dragWin).Show(); } } }