void CloseClick(object Sender, RoutedEventArgs E) { SelectedScreen = null; SelectedWindow = null; BeginClose(); }
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)); var window = _windows .Where(M => !_skipWindows.Contains(M.Handle)) .FirstOrDefault(M => M.Rectangle.Contains(point)); if (window != null) { SelectedWindow = window; Cursor = Cursors.Hand; var rect = window.Rectangle; WindowBorder.Margin = new Thickness(rect.Left / Dpi.X, rect.Top / Dpi.Y, 0, 0); WindowBorder.Width = rect.Width / Dpi.X; WindowBorder.Height = rect.Height / Dpi.Y; WindowBorder.Visibility = Visibility.Visible; } else { SelectedWindow = null; Cursor = Cursors.Arrow; WindowBorder.Visibility = Visibility.Collapsed; } }
public Bitmap ScreenShotWindow(Window hWnd) { _systemTray.HideNotification(); if (hWnd == Window.DesktopWindow) { return(ScreenShot.Capture(Settings.IncludeCursor).Transform(Settings.ScreenShots)); } var bmp = ScreenShot.CaptureTransparent(hWnd, Settings.IncludeCursor, Settings.ScreenShots.Resize, Settings.ScreenShots.ResizeWidth, Settings.ScreenShots.ResizeHeight); // Capture without Transparency if (bmp == null) { try { return(ScreenShot.Capture(hWnd, Settings.IncludeCursor)?.Transform(Settings.ScreenShots)); } catch { return(null); } } return(bmp.Transform(Settings.ScreenShots, true)); }
VideoSourcePickerWindow(VideoPickerMode Mode) { _mode = Mode; InitializeComponent(); Left = Top = 0; Width = SystemParameters.VirtualScreenWidth; Height = SystemParameters.VirtualScreenHeight; UpdateBackground(); _screens = Screen.AllScreens; _windows = Window.EnumerateVisible().ToArray(); ShowCancelText(); }
public WindowPicker(IEnumerable <IntPtr> SkipWindows) { _skipWindows = SkipWindows ?? new IntPtr[0]; InitializeComponent(); Left = Top = 0; Width = SystemParameters.VirtualScreenWidth; Height = SystemParameters.VirtualScreenHeight; UpdateBackground(); ShowCancelText(); _windows = Window.EnumerateVisible().ToArray(); }
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; } }
public Bitmap ScreenShotWindow(Window hWnd) { if (hWnd == Window.DesktopWindow) { return(ScreenShot.Capture(Settings.IncludeCursor)); } else { var bmp = ScreenShot.CaptureTransparent(hWnd, Settings.IncludeCursor, Settings.ScreenShotDoResize, Settings.ScreenShotResizeWidth, Settings.ScreenShotResizeHeight); // Capture without Transparency if (bmp == null) { bmp = ScreenShot.Capture(hWnd, Settings.IncludeCursor); } return(bmp); } }
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 => Predicate?.Invoke(M) ?? true) .FirstOrDefault(M => M.Rectangle.Contains(point)); UpdateBorderAndCursor(SelectedWindow?.Rectangle); break; } }
void CloseClick(object Sender, RoutedEventArgs E) { SelectedWindow = null; Close(); }