コード例 #1
0
            private DockPane PaneAtPointNativeFloatingWindows(IDragSource source, double deltaX, double deltaY, out bool stopHitTest)
            {
                stopHitTest = false;

                FloatingWindowCollection floatingWindows = DockControl.FloatingWindows;
                Point pt = GetStartMousePosition(_overlayWindow);

                pt.Offset(deltaX, deltaY);
                for (int i = floatingWindows.Count - 1; i >= 0; i--)
                {
                    FloatingWindow floatingWindow = floatingWindows[i];
                    if (!floatingWindow.IsVisible)
                    {
                        continue;
                    }
                    NativeFloatingWindow nativeWindow = NativeFloatingWindow.GetNativeFloatingWindow(floatingWindow);
                    Rect windowBounds = nativeWindow.GetPreviewBounds(_overlayWindow);
                    stopHitTest = windowBounds.Contains(pt);
                    if (stopHitTest)
                    {
                        pt = GetStartMousePosition(nativeWindow);
                        pt.Offset(deltaX, deltaY);
                        var result = PaneFromHitTestResult(source, VisualTreeHelper.HitTest(nativeWindow, pt));
                        if (result == null || !source.CanDrop(result))
                        {
                            stopHitTest = false;
                            continue;
                        }
                        return(result);
                    }
                }

                return(null);
            }
コード例 #2
0
            private void TargetAtPointNativeWindows(double deltaX, double deltaY)
            {
                Point pt = GetStartMousePosition(_overlayWindow);

                pt.Offset(deltaX, deltaY);
                VisualTreeHelper.HitTest(_overlayWindow, null,
                                         new HitTestResultCallback(TargetAtPointHitTestResultCallback),
                                         new PointHitTestParameters(pt));

                if (_targetAtPoint.HasValue)
                {
                    return;
                }

                FloatingWindowCollection floatingWindows = DockControl.FloatingWindows;

                for (int i = floatingWindows.Count - 1; i >= 0; i--)
                {
                    FloatingWindow floatingWindow = floatingWindows[i];
                    if (!floatingWindow.IsVisible)
                    {
                        continue;
                    }
                    NativeFloatingWindow nativeWindow = NativeFloatingWindow.GetNativeFloatingWindow(floatingWindow);
                    if (nativeWindow == null)
                    {
                        continue;
                    }
                    Rect windowBounds = nativeWindow.GetPreviewBounds(_overlayWindow);
                    if (windowBounds.Contains(pt))
                    {
                        pt = GetStartMousePosition(nativeWindow);
                        pt.Offset(deltaX, deltaY);
                        _targetAtPoint = TargetFromHitTestResult(VisualTreeHelper.HitTest(nativeWindow, pt));
                        if (!_targetAtPoint.HasValue)
                        {
                            _targetAtPoint = Target.Empty;
                        }
                        return;
                    }
                }
            }