예제 #1
0
        void WindowMouseMove(object Sender, MouseEventArgs E)
        {
            var pos = E.GetPosition(this);

            var point = new Point((int)(pos.X * Dpi.X), (int)(pos.Y * Dpi.Y));

            void UpdateBorderAndCursor(Rectangle?Rect)
            {
                if (Rect == null)
                {
                    Cursor = Cursors.Arrow;

                    Border.Visibility = Visibility.Collapsed;
                }
                else
                {
                    Cursor = Cursors.Hand;

                    var rect = Rect.Value;

                    Border.Margin = new Thickness(rect.Left / Dpi.X, rect.Top / Dpi.Y, 0, 0);

                    Border.Width  = rect.Width / Dpi.X;
                    Border.Height = rect.Height / Dpi.Y;

                    Border.Visibility = Visibility.Visible;
                }
            }

            switch (_mode)
            {
            case VideoPickerMode.Screen:
                SelectedScreen = _screens.FirstOrDefault(M => M.Bounds.Contains(point));

                UpdateBorderAndCursor(SelectedScreen?.Bounds);
                break;

            case VideoPickerMode.Window:
                SelectedWindow = _windows
                                 .Where(M => !SkipWindows.Contains(M.Handle))
                                 .FirstOrDefault(M => M.Rectangle.Contains(point));

                UpdateBorderAndCursor(SelectedWindow?.Rectangle);
                break;
            }
        }
        void WindowMouseMove(object Sender, MouseEventArgs E)
        {
            var point = MouseCursor.CursorPosition;

            switch (_mode)
            {
            case VideoPickerMode.Screen:
                SelectedScreen = _screens.FirstOrDefault(M => M.Bounds.Contains(point));

                UpdateBorderAndCursor(SelectedScreen?.Bounds);
                break;

            case VideoPickerMode.Window:
                SelectedWindow = _windows
                                 .Where(M => !SkipWindows.Contains(M.Handle))
                                 .FirstOrDefault(M => M.Rectangle.Contains(point));

                UpdateBorderAndCursor(SelectedWindow?.Rectangle);
                break;
            }
        }