//Switch between Rectangle Snapping and Painting private void SwitchMode() { SelectionRectangle.IsEnabled = !SelectionRectangle.IsEnabled; PaintSurface.IsEnabled = !PaintSurface.IsEnabled; _currentPath = null; //"Hide" Selection Rectangle SelectionRectangle.Margin = new Thickness(99999); //Stop animations by setting AnimationTimeline to null SelectedMode.BeginAnimation(OpacityProperty, null); //Set correct Selected Mode Indicator if (SelectionRectangle.IsEnabled) { //Prevent Painting in Capture Rectangle mode SelectionRectangle.CaptureMouse(); Cursor = Cursors.Cross; CropIcon.Background = Brushes.Gray; DrawIcon.Background = Brushes.Transparent; } else { //Prevent Capturing Rectangle in Paint Mode PaintSurface.CaptureMouse(); Cursor = Cursors.Pen; DrawIcon.Background = Brushes.Gray; CropIcon.Background = Brushes.Transparent; } //Fade Selected Mode View in FadeSelectedModeIn(); }
private void WindowLoaded(object sender, RoutedEventArgs e) { SelectionRectangle.CaptureMouse(); Activate(); Focus(); //Hide in Alt + Tab Switcher View WindowInteropHelper wndHelper = new WindowInteropHelper(this); int exStyle = (int)NativeMethods.GetWindowLong(wndHelper.Handle, (int)NativeMethods.GetWindowLongFields.GwlExstyle); exStyle |= (int)NativeMethods.ExtendedWindowStyles.WsExToolwindow; NativeMethods.SetWindowLong(wndHelper.Handle, (int)NativeMethods.GetWindowLongFields.GwlExstyle, (IntPtr)exStyle); }
private void WindowLoaded(object sender, RoutedEventArgs e) { SelectionRectangle.CaptureMouse(); //Set Position for Spacebar Menu Rectangle bounds = Screen.PrimaryScreen.Bounds; SelectedMode.Margin = new Thickness( bounds.Width / 2 - 50, bounds.Height / 2 - 25, bounds.Width / 2 - 50, bounds.Height / 2 - 25); WindowHelper.WindowLoaded(this); }