Exemple #1
0
        //Switch between Rectangle Snapping and Painting
        private void SwitchMode()
        {
            Grid.IsEnabled         = !Grid.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 (Grid.IsEnabled)
            {
                //Prevent Painting in Capture Rectangle mode
                Grid.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();
        }
Exemple #2
0
        //Fade the Selected Mode (Drawing/Rectangle) in
        private void FadeSelectedModeIn()
        {
            DoubleAnimation anim = new DoubleAnimation(0, TimeSpan.FromSeconds(0.25));

            anim.Completed += FadeSelectedModeOut;
            anim.From       = SelectedMode.Opacity;
            anim.To         = 0.9;

            SelectedMode.BeginAnimation(OpacityProperty, anim);
        }
Exemple #3
0
        //Fade the Selected Mode (Drawing/Rectangle) out
        private void FadeSelectedModeOut(object sender, EventArgs e)
        {
            DoubleAnimation anim = new DoubleAnimation(0, TimeSpan.FromSeconds(0.25))
            {
                BeginTime = TimeSpan.FromMilliseconds(1000),
                From      = SelectedMode.Opacity,
                To        = 0
            };

            SelectedMode.BeginAnimation(OpacityProperty, anim);
        }