コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();
            _effect         = FindResource("Shadow") as DropShadowEffect;
            _timer          = new DispatcherTimer();
            _timer.Tick    += new EventHandler(timer_Tick);
            _timer.Interval = TimeSpan.FromMilliseconds(7);
            //Task.Run(() =>
            //{
            //    while (true)
            //    {
            //        GetDir(out var dir);
            //        Dispatcher.Invoke(() =>
            //        {
            //            _left = (double)_fly.GetValue(Canvas.LeftProperty);
            //            _top = (double)_fly.GetValue(Canvas.TopProperty);
            //            Canvas.SetLeft(_fly, _left + dir.X);
            //            Canvas.SetTop(_fly, _top + dir.Y);

            //            _fly.RenderTransform = new ScaleTransform(dir.Scale, dir.Scale);
            //            _effect.ShadowDepth = dir.Scale * 7;
            //        });
            //    }
            //});

            _ws            = new WebSocket("ws://greatservice.azurewebsites.net/?name=Console&room=great");
            _ws.OnMessage += (sender, e) =>
            {
                Accelerometer acc;
                try
                {
                    acc = JsonConvert.DeserializeObject <Accelerometer>(e.Data);
                }
                catch (Exception ex)
                {
                    return;
                }

                Dir dir;
                dir.X = acc.x * -10;
                dir.Y = acc.y * 10;
                var coef         = 0.981;
                var scaleDefault = 1;

                dir.Scale = ((acc.z - coef) + scaleDefault) * 1.6;
                Dispatcher.Invoke(() =>
                {
                    _left = (double)_fly.GetValue(Canvas.LeftProperty);
                    _top  = (double)_fly.GetValue(Canvas.TopProperty);
                    Canvas.SetLeft(_fly, _left + dir.X);
                    Canvas.SetTop(_fly, _top + dir.Y);

                    _fly.RenderTransform = new ScaleTransform(dir.Scale, dir.Scale);
                    _effect.ShadowDepth  = dir.Scale * 7;
                });
            };

            _ws.Connect();
            _ws.Send("BALUS");
        }
コード例 #2
0
        public object GetCurrentValue(DropShadowEffect defaultOriginValue,
                                      DropShadowEffect defaultDestinationValue,
                                      AnimationClock animationClock)
        {
            if (!animationClock.CurrentProgress.HasValue)
            {
                return(new DropShadowEffect());
            }

            defaultOriginValue = this.From ?? defaultOriginValue;
            if (animationClock.CurrentProgress.Value == 0)
            {
                return(defaultOriginValue);
            }

            defaultDestinationValue = this.To ?? defaultDestinationValue;
            if (animationClock.CurrentProgress.Value == 1)
            {
                return(defaultDestinationValue);
            }

            double           interpolation     = animationClock.CurrentProgress.Value;
            double           blurRadius        = (defaultDestinationValue.BlurRadius - defaultOriginValue.BlurRadius) * interpolation + defaultOriginValue.BlurRadius;
            double           direction         = (defaultDestinationValue.Direction - defaultOriginValue.Direction) * interpolation + defaultOriginValue.Direction;
            double           shadowDepth       = (defaultDestinationValue.ShadowDepth - defaultOriginValue.ShadowDepth) * interpolation + defaultOriginValue.ShadowDepth;
            double           opacity           = (defaultDestinationValue.Opacity - defaultOriginValue.Opacity) * interpolation + defaultOriginValue.Opacity;
            DropShadowEffect appliedDropShadow = this.CurrentEffect ?? new DropShadowEffect();

            appliedDropShadow.BlurRadius  = blurRadius;
            appliedDropShadow.Direction   = direction;
            appliedDropShadow.ShadowDepth = shadowDepth;
            appliedDropShadow.Opacity     = opacity;
            return(appliedDropShadow);
        }
コード例 #3
0
        public CardCanvas(Card card, Image cardImage, double width, double height, Thickness margin, bool isUpgrade, DefaultPage currentPage = null)
        {
            string baseLocation = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;

            filteredLocation = System.IO.Path.GetDirectoryName(baseLocation).Replace("file:\\", "") + "\\Misc\\";
            this.margin      = margin;
            this.cardImage   = cardImage;
            this.currentPage = currentPage;
            this.height      = height;
            this.width       = width;
            this.isUpgrade   = isUpgrade;

            DropShadowEffect dropShadow = new DropShadowEffect();

            dropShadow.BlurRadius  = Opt.ApResMod(2);
            dropShadow.ShadowDepth = Opt.ApResMod(1);
            Effect = dropShadow;

            if (this.isUpgrade)
            {
                upgrade = (Upgrade)card;
            }
            else
            {
                pilot = (Pilot)card;
            }

            ConstructCanvas();
        }
コード例 #4
0
 void BtnConfiguraciones_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     //mostrar zona configuracion
     if (gridConfiguracion.Visibility == System.Windows.Visibility.Hidden)
     {
         gridConfiguracion.Visibility = System.Windows.Visibility.Visible;
         for (int i = 1; i < TAM_PANEL_CONFIGURACION; i += 5)
         {
             gridConfiguracion.Height = i;
             logic.Constantes.DoEvents(this.Dispatcher);
             //System.Threading.Thread.Sleep(1);
         }
         txtNombre.Text = logic.Constantes.GIT_USER;
         txtEmail.Text  = logic.Constantes.GIT_EMAIL;
         DropShadowEffect sombra = new DropShadowEffect();
         sombra.Direction         = -90;
         sombra.ShadowDepth       = 15;
         sombra.BlurRadius        = 20;
         gridConfiguracion.Effect = sombra;
     }
     else
     {
         for (int i = TAM_PANEL_CONFIGURACION; i >= 1; i -= 2)
         {
             gridConfiguracion.Height = i;
             logic.Constantes.DoEvents(this.Dispatcher);
         }
         gridConfiguracion.Visibility = System.Windows.Visibility.Hidden;
         gridConfiguracion.Effect     = null;
     }
 }
コード例 #5
0
ファイル: ScrollPanel.cs プロジェクト: floatas/PdfiumViewer
        public ScrollPanel()
        {
            VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            Effect = new DropShadowEffect()
            {
                BlurRadius    = 10,
                Direction     = 270,
                RenderingBias = RenderingBias.Performance,
                ShadowDepth   = 0
            };
            Panel = new StackPanel()
            {
                HorizontalAlignment = HorizontalAlignment.Center
            };
            VirtualizingPanel.SetIsVirtualizing(Panel, true);
            VirtualizingPanel.SetVirtualizationMode(Panel, VirtualizationMode.Recycling);
            Content = Panel;

            ZoomMode         = PdfViewerZoomMode.FitHeight;
            Rotate           = PdfRotation.Rotate0;
            Flags            = PdfRenderFlags.None;
            PagesDisplayMode = PdfViewerPagesDisplayMode.SinglePageMode;
            MouseWheelMode   = MouseWheelMode.PanAndZoom;
            Dpi         = 96;
            ScrollWidth = 50;
            Zoom        = 1;
            ZoomMin     = DefaultZoomMin;
            ZoomMax     = DefaultZoomMax;
            ZoomFactor  = DefaultZoomFactor;
            FrameSpace  = new Thickness(5);
        }
コード例 #6
0
        void bash_Effect(object sender, MouseButtonEventArgs e)
        {
            if (b != null)
            {
                b.Effect = null;
                b        = null;
                return;
            }
            if (b == (DockPanel)sender)
            {
                b = null;
                return;
            }

            b = (DockPanel)sender;
            if (b.Children.Count > 0)
            {
                DropShadowEffect dropShadowEffect = new DropShadowEffect();
                dropShadowEffect.ShadowDepth = 0;
                dropShadowEffect.Color       = Colors.Red;
                dropShadowEffect.Opacity     = 20;
                dropShadowEffect.BlurRadius  = 20;
                b.Effect = dropShadowEffect;
            }
        }
コード例 #7
0
ファイル: Card.xaml.cs プロジェクト: HarelM/Set-Game
 private void DrawShapes(Shape[] shapes, SolidColorBrush brushOutLine)
 {
     for (int iIndex = 0; iIndex < m_iNumber; iIndex++)
     {
         shapes[iIndex].Stroke = brushOutLine;
         shapes[iIndex].Fill   = GetFillBrush(brushOutLine, brushOutLine.Color);
         DropShadowEffect dropShadowEffect = new DropShadowEffect();
         dropShadowEffect.BlurRadius = 10;
         shapes[iIndex].Effect       = dropShadowEffect;
         double dMarginX = gridCard.ColumnDefinitions[iIndex].ActualWidth / 10;
         double dMarginY = gridCard.RowDefinitions[0].ActualHeight / 10;
         m_arrViewBox[iIndex]         = new Viewbox();
         m_arrViewBox[iIndex].Child   = shapes[iIndex];
         m_arrViewBox[iIndex].Margin  = new Thickness(dMarginX, dMarginY, dMarginX, dMarginY);
         m_arrViewBox[iIndex].Stretch = Stretch.Uniform;
         if (m_iNumber == 1)
         {
             Grid.SetColumn(m_arrViewBox[iIndex], 1);
         }
         else
         {
             Grid.SetColumn(m_arrViewBox[iIndex], iIndex);
         }
         gridCard.Children.Add(m_arrViewBox[iIndex]);
     }
 }
コード例 #8
0
        public static FrameworkElement WrapElementWithDropShadow(FrameworkElement fe)
        {
            Grid g = new Grid();

            g.Margin = new Thickness(5);

            {
                Border b = new Border();
                b.Background      = Brushes.White;
                b.BorderThickness = new Thickness(1);
                b.CornerRadius    = new CornerRadius(5);
                b.BorderBrush     = Brushes.LightGray;
                {
                    var effect = new DropShadowEffect();
                    effect.Color = Colors.LightGray;
                    b.Effect     = effect;
                }
                g.Children.Add(b);
            }

            {
                Grid gg = new Grid();
                gg.Margin = new Thickness(5);
                gg.Children.Add(fe);
                gg.ClipToBounds = true;
                g.Children.Add(gg);
            }

            return(g);
        }
コード例 #9
0
        /// <summary>
        /// Returns new DropShadowEffect with values eased from startValue to endValue using a time percentage 0 -> 1.
        /// </summary>
        public static DropShadowEffect EaseValue(DropShadowEffect startValue, DropShadowEffect endValue, double percent)
        {
            if (startValue == null)
            {
                startValue = new DropShadowEffect {
                    Color = Color.FromArgb(0, 0, 0, 0), Opacity = 0
                }
            }
            ;
            if (endValue == null)
            {
                endValue = new DropShadowEffect {
                    Color = Color.FromArgb(0, 0, 0, 0), Opacity = 0
                }
            }
            ;

            return(new DropShadowEffect {
                BlurRadius = EaseValue(startValue.BlurRadius, endValue.BlurRadius, percent),
                Color = EaseValue(startValue.Color, endValue.Color, percent),
                Direction = EaseValue(startValue.Direction, endValue.Direction, percent),
                Opacity = EaseValue(startValue.Opacity, endValue.Opacity, percent),
                ShadowDepth = EaseValue(startValue.ShadowDepth, endValue.ShadowDepth, percent)
            });
        }
コード例 #10
0
        private void AssociatedObject_TouchEnter(object sender, TouchEventArgs e)
        {
            Border element            = sender as Border;
            LinearGradientBrush brush = new LinearGradientBrush();

            brush.StartPoint = new Point(0, 0.5);
            brush.EndPoint   = new Point(1, 0.5);
            brush.GradientStops.Add(new GradientStop(Colors.Gray, 0));
            brush.GradientStops.Add(new GradientStop(Color.FromRgb(32, 32, 32), 1));
            brush.GradientStops.Add(new GradientStop(Colors.Black, 1));
            element.Background = brush;

            Border childBorder = element.Child as Border;

            childBorder.Background = new SolidColorBrush(Color.FromArgb(60, 229, 255, 77));
            DropShadowEffect childEffect = new DropShadowEffect();

            childEffect.BlurRadius = 20;
            childEffect.Color      = Color.FromArgb(120, 255, 255, 255);
            childBorder.Effect     = childEffect;

            DropShadowEffect effect = new DropShadowEffect();

            effect.ShadowDepth = 0;
            effect.BlurRadius  = 10;
            element.Effect     = effect;
        }
コード例 #11
0
        public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag)
        {
            NumberedBookmarkTag nTag = tag as NumberedBookmarkTag;

            // Ensure we can draw a glyph for this marker.
            if (nTag == null)
            {
                return(null);
            }
            Border b = new Border();

            b.Background      = Brushes.LightBlue;
            b.CornerRadius    = new CornerRadius(4);
            b.BorderThickness = new Thickness(1.0);
            b.BorderBrush     = Brushes.DarkBlue;
            b.Width           = 12;
            b.Height          = m_glyphSize;
            b.Child           = new TextBlock()
            {
                Text = nTag.Numbers.First().ToString(), HorizontalAlignment = HorizontalAlignment.Center
            };
            //if more than one number on same line, add a shadow
            if (nTag.Numbers.Length > 1)
            {
                var effect = new DropShadowEffect();
                effect.BlurRadius  = 3;
                effect.Direction   = 0;
                effect.ShadowDepth = 3;
                effect.Color       = Colors.LightBlue;
                b.Effect           = effect;
                b.ToolTip          = string.Format("There is several bookmarks at this line : {0}", string.Join("..", nTag.Numbers.Select(x => x.ToString())));
            }
            return(b);
        }
コード例 #12
0
        //TODO: Optimizing the performance of danmaku animation with shadow.
        public EmojiDanmaku(string path)
        {
            FontSize   = 24;
            Foreground = Brushes.White;
            ImageSource img = new BitmapImage(new Uri(@path, UriKind.RelativeOrAbsolute));

            //自适应图片大小
            // Height = img.Height;
            //Width = img.Width;
            //固定图片大小
            Height     = 80;
            Width      = 80;
            Background = new ImageBrush(img);
            Effect     = new DropShadowEffect
            {
                Color         = Colors.Black,
                BlurRadius    = 2,
                ShadowDepth   = 1,
                Opacity       = 1,
                RenderingBias = RenderingBias.Performance
            };

            Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
            Arrange(new Rect(0, 0, DesiredSize.Width, DesiredSize.Height));
        }
コード例 #13
0
        private void listProducts()
        {
            List <Product> products = ProductQuery.getProducts();

            foreach (Product product in products)
            {
                ProductBox productBox = new ProductBox(product, this);

                Border border = new Border();

                border.BorderBrush     = Brushes.Black;
                border.BorderThickness = new Thickness(2);
                border.CornerRadius    = new CornerRadius(5);
                border.Margin          = new Thickness(20);
                border.Padding         = new Thickness(15);
                border.Background      = Brushes.White;

                DropShadowEffect DropShadow = new DropShadowEffect();
                DropShadow.BlurRadius = 5;
                DropShadow.Color      = Color.FromRgb(0, 0, 0);
                DropShadow.Opacity    = 1;

                border.Effect = DropShadow;

                border.Child = productBox;

                _productContainer.Children.Add(border);
            }
        }
コード例 #14
0
        private void PrepareWinnerColors(LobbyPlayer elem, int order)
        {
            Color c;

            if (order == 0)
            {
                c = Colors.Gold;
            }
            else if (order == 1)
            {
                c = Colors.Silver;
            }
            else if (order == 2)
            {
                c = Color.FromRgb(140, 120, 83);
            }
            else
            {
                c = Colors.LightGray;
            }

            elem.border.Background = new SolidColorBrush(c);
            if (order < 3)
            {
                DropShadowEffect effect = new DropShadowEffect();
                effect.Color      = c;
                effect.BlurRadius = 10;
                effect.Direction  = 0;

                //    elem.border.Effect = effect;
            }
        }
コード例 #15
0
 // TODO: Refactor this.
 // This code is replicated (almost) in all toolbar button classes
 // Also consider using Visual State Manager when doing it
 private void IndicateChecked(bool isChecked)
 {
     if (isChecked)
     {
         var outerGlow = new DropShadowEffect();
         outerGlow.ShadowDepth          = 0;
         outerGlow.BlurRadius           = 20;
         outerGlow.Opacity              = 1;
         outerGlow.Color                = MacroStyle.MacroCheckedButtonGlow;
         ButtonComponent.Effect         = outerGlow;
         CheckedIndicator.Stroke        = new SolidColorBrush(MacroStyle.MacroButtonOutlineChecked);
         CheckedIndicator.Fill          = new SolidColorBrush(MacroStyle.MacroButtonOutlineChecked);
         OverlayCheckedIndicator.Stroke = new SolidColorBrush(MacroStyle.MacroButtonOutlineChecked);
         OverlayCheckedIndicator.Fill   = new SolidColorBrush(MacroStyle.MacroButtonOutlineChecked);
         OverlayCheckedIndicator.Width  = ButtonComponent.Width / 2;
         OverlayCheckedIndicator.Height = ButtonComponent.Height / 2;
     }
     else
     {
         ButtonComponent.Effect         = null;
         CheckedIndicator.Stroke        = new SolidColorBrush(MacroStyle.MacroButtonOutlineUnchecked);
         CheckedIndicator.Fill          = new SolidColorBrush(MacroStyle.MacroButtonOutlineUnchecked);
         OverlayCheckedIndicator.Stroke = new SolidColorBrush(MacroStyle.MacroButtonOutlineUnchecked);
         OverlayCheckedIndicator.Fill   = new SolidColorBrush(MacroStyle.MacroButtonOutlineUnchecked);
         OverlayCheckedIndicator.Width  = ButtonComponent.Width / 2;
         OverlayCheckedIndicator.Height = ButtonComponent.Height / 2;
     }
 }
コード例 #16
0
        private Path CreateLeadingLine(Point startPoint, Point endPoint)
        {
            /* Create a cursive line */
            //LineSegment line = new LineSegment() { Point = endPoint };
            //PathFigure figure = new PathFigure() { StartPoint = startPoint, IsClosed = false, IsFilled = false };
            //figure.Segments.Add(line);

            //PathGeometry data = new PathGeometry();
            //data.Figures.Add(figure);

            /* Create a straight line */
            LineGeometry data = new LineGeometry()
            {
                StartPoint = startPoint, EndPoint = endPoint
            };
            DropShadowEffect effect = new DropShadowEffect()
            {
                Color = Colors.Black, ShadowDepth = 0
            };
            Path lead = new Path()
            {
                Data = data, Stroke = new SolidColorBrush(Colors.White), Effect = effect
            };

            return(lead);
        }
コード例 #17
0
        public PDFRendererPageControl(int page, PDFRendererControl pdf_renderer_control, PDFRendererControlStats pdf_renderer_control_stats, bool add_bells_and_whistles)
        {
            InitializeComponent();

            this.page = page;
            this.pdf_renderer_control       = pdf_renderer_control;
            this.pdf_renderer_control_stats = pdf_renderer_control_stats;
            this.add_bells_and_whistles     = add_bells_and_whistles;

            // Start with a reasonable size
            this.Background = Brushes.White;
            this.Height     = remembered_image_height * pdf_renderer_control_stats.zoom_factor;
            this.Width      = remembered_image_width * pdf_renderer_control_stats.zoom_factor;

            page_layers = new List <PageLayer>();

            // Try to trap the DAMNED cursor keys escape route
            KeyboardNavigation.SetDirectionalNavigation(this, KeyboardNavigationMode.None);

            SetOperationMode(PDFRendererControl.OperationMode.Hand);

            this.MouseDown += PDFRendererPageControl_MouseDown;

            this.pdf_renderer_control_stats.pdf_document.PDFRenderer.OnPageTextAvailable += pdf_renderer_OnPageTextAvailable;

            if (add_bells_and_whistles)
            {
                DropShadowEffect dse = new DropShadowEffect();
                dse.Color   = ThemeColours.Background_Color_Blue_Dark;
                this.Effect = dse;
            }

            PopulateNeededLayers();
        }
コード例 #18
0
        public ThrustControllerWindow()
        {
            InitializeComponent();

            // Error Effect
            _errorEffect = new DropShadowEffect()
            {
                Color       = UtilityWPF.ColorFromHex("FF8175"),
                BlurRadius  = 9,
                Direction   = 0,
                ShadowDepth = 0,
                Opacity     = .8,
            };

            // ThrusterType Combo
            foreach (ThrusterTypeValues value in Enum.GetValues(typeof(ThrusterTypeValues)))
            {
                cboThrusterTypes.Items.Add(value);
            }
            cboThrusterTypes.SelectedItem = ThrusterTypeValues.Random;

            _graphTimer = new DispatcherTimer()
            {
                Interval  = TimeSpan.FromMilliseconds(150),
                IsEnabled = false,
            };
            _graphTimer.Tick += GraphTimer_Tick;

            _initialized = true;
        }
コード例 #19
0
ファイル: MyLine.cs プロジェクト: Rogal27/PolygonDrawer
        public void SelectEdge()
        {
            DropShadowEffect effect = new DropShadowEffect();

            switch (Globals.lineDrawingMode)
            {
            case LineDrawingMode.Bresenham:
                DrawBresenhamLine(Globals.SelectedEdgeColor);
                break;

            case LineDrawingMode.Library:
                effect                    = new DropShadowEffect();
                effect.BlurRadius         = Globals.SelectedEdgeBlurRadius;
                effect.Color              = Globals.SelectedEdgeColor;
                effect.Direction          = 0;
                effect.ShadowDepth        = 0;
                effect.Opacity            = 0.9;
                lineWindowsControl.Stroke = new SolidColorBrush(Globals.SelectedEdgeColor);
                lineWindowsControl.Effect = effect;
                break;

            case LineDrawingMode.AntialiasingWU:
                //TODO
                DrawAntialiasedWULine(Globals.SelectedEdgeColor);
                break;

            case LineDrawingMode.BresenhamSymmetric:
                DrawBresenhamSymmetricLine(Globals.SelectedEdgeColor);
                break;

            default:
                break;
            }
        }
コード例 #20
0
        private void ClickWindow(Point point, Canvas canvas)
        {
            count++;
            if (count > 10)
            {
                return;
            }

            Path path = new Path();

            //path.Fill = AttachedProperty.GetFillColor(path);
            path.Stroke  = AttachedProperty.GetFillColor(path);
            path.Opacity = 1 - count * 0.1 >= 0.5 ? 1 - count * 0.1 : 0.5;
            DropShadowEffect dropShadowEffect = new DropShadowEffect();

            dropShadowEffect.BlurRadius  = 10;
            dropShadowEffect.Color       = Colors.LightGray;
            dropShadowEffect.ShadowDepth = 1;
            dropShadowEffect.Direction   = 90;
            path.Effect = dropShadowEffect;
            EllipseGeometry ellipseGeometry = new EllipseGeometry(point, 1 + 3 * count, 1 + 3 * count);

            path.Data = ellipseGeometry;
            canvas.Children.Add(path);
        }
コード例 #21
0
        private Style createImageEffect()
        {
            var effect = new DropShadowEffect()
            {
                ShadowDepth = 0,
                Color       = Color.FromRgb(0, 51, 102),
                Opacity     = 1,
                BlurRadius  = 1
            };

            var setter = new Setter()
            {
                Property = UIElement.EffectProperty,
                Value    = effect
            };

            var trigger = new Trigger()
            {
                Property = UIElement.IsMouseOverProperty,
                Value    = true,
                Setters  = { setter }
            };

            var style = new Style()
            {
                Triggers = { trigger }
            };

            return(style);
        }
コード例 #22
0
        // TODO: Refactor this.
        // This code is replicated (almost) in all toolbar button classes
        // Also consider using Visual State Manager when doing it
        private void IndicateChecked(bool isChecked)
        {
            if (isChecked)
            {
                var outerGlow = new DropShadowEffect
                {
                    ShadowDepth = 0,
                    BlurRadius  = 20,
                    Opacity     = 1,
                    Color       = ClearCanvasStyle.ClearCanvasCheckedButtonGlow
                };
                ButtonComponent.Effect         = outerGlow;
                CheckedIndicator.Stroke        = new SolidColorBrush(ClearCanvasStyle.ClearCanvasButtonOutlineChecked);
                CheckedIndicator.Fill          = new SolidColorBrush(ClearCanvasStyle.ClearCanvasButtonOutlineChecked);
                OverlayCheckedIndicator.Stroke = new SolidColorBrush(ClearCanvasStyle.ClearCanvasButtonOutlineChecked);
                OverlayCheckedIndicator.Fill   = new SolidColorBrush(ClearCanvasStyle.ClearCanvasButtonOutlineChecked);
                OverlayCheckedIndicator.Width  = ButtonComponent.Width / 2;
                OverlayCheckedIndicator.Height = ButtonComponent.Height / 2;
            }
            else
            {
                ButtonComponent.Effect         = null;
                CheckedIndicator.Stroke        = new SolidColorBrush(ClearCanvasStyle.ClearCanvasButtonOutlineUnchecked);
                CheckedIndicator.Fill          = new SolidColorBrush(ClearCanvasStyle.ClearCanvasButtonOutlineUnchecked);
                OverlayCheckedIndicator.Stroke = new SolidColorBrush(ClearCanvasStyle.ClearCanvasButtonOutlineUnchecked);
                OverlayCheckedIndicator.Fill   = new SolidColorBrush(ClearCanvasStyle.ClearCanvasButtonOutlineUnchecked);


                OverlayCheckedIndicator.Width  = ButtonComponent.Width / 2;
                OverlayCheckedIndicator.Height = ButtonComponent.Height / 2;
            }
        }
コード例 #23
0
        void LblDarOpinion_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (gridOpiniones.Height < TAM_PANEL_DAR_OPINION)
            {
                for (int i = 25; i < TAM_PANEL_DAR_OPINION; i += 5)
                {
                    gridOpiniones.Height = i;
                    logic.Constantes.DoEvents(this.Dispatcher);
                }
                gridOpiniones.Height = TAM_PANEL_DAR_OPINION;

                DropShadowEffect sombra = new DropShadowEffect();
                sombra.Direction   = -90;
                sombra.ShadowDepth = 15;
                sombra.BlurRadius  = 20;

                gridOpiniones.Effect = sombra;
            }
            else
            {
                for (int i = TAM_PANEL_DAR_OPINION; i >= 25; i -= 2)
                {
                    gridOpiniones.Height = i;
                    logic.Constantes.DoEvents(this.Dispatcher);
                }
                gridOpiniones.Height = 25;
                gridOpiniones.Effect = null;
            }
        }
コード例 #24
0
ファイル: MainWindow.xaml.cs プロジェクト: NotaRobotexe/Radar
        private void intruderSetting()
        {
            SolidColorBrush br = new SolidColorBrush();

            br.Color = Color.FromRgb(235, 12, 12);

            DropShadowEffect she = new DropShadowEffect();

            she.Color       = Color.FromScRgb(0, 0, 2.3f, 255);
            she.ShadowDepth = 0;
            she.Direction   = 0;
            she.BlurRadius  = 20;

            for (int i = 0; i < 181; i++)
            {
                intr[i] = new Ellipse();

                intr[i].Width           = 12;
                intr[i].Height          = 12;
                intr[i].StrokeThickness = 4;
                intr[i].Stroke          = br;
                intr[i].Fill            = br;
                // intr[i].Effect = she;
            }
        }
コード例 #25
0
        private void userMouseEnter(object sender, MouseEventArgs e)
        {
            mplayer.Play();
            DropShadowEffect myDropShadowEffect = new DropShadowEffect();
            // Set the color of the shadow to Black.
            Color myShadowColor = new Color();

            myShadowColor.ScA        = 1;
            myShadowColor.ScB        = 0;
            myShadowColor.ScG        = 0;
            myShadowColor.ScR        = 0;
            myDropShadowEffect.Color = myShadowColor;

            // Set the direction of where the shadow is cast to 320 degrees.
            myDropShadowEffect.Direction = 320;

            // Set the depth of the shadow being cast.
            myDropShadowEffect.ShadowDepth = 5;

            // Set the shadow opacity to half opaque or in other words - half transparent.
            // The range is 0-1.
            myDropShadowEffect.Opacity = 0.5;

            // Apply the bitmap effect to the Button.
            ((Button)sender).Effect = myDropShadowEffect;
        } // Adds shadow effects on mouse enter.
コード例 #26
0
 /// <summary>
 /// 阴影自适应
 /// </summary>
 private void ShadowSelfAdaption()
 {
     if (Effect == null && Shadow)
     {
         Effect = new DropShadowEffect()
         {
             BlurRadius = downRadius, Opacity = shadowOpacity, ShadowDepth = downDepth, Direction = shadowDireection
         };
     }
     if (Background != null && OpenShadowSelfAdaption)
     {
         Color c;
         if (Background is SolidColorBrush)
         {
             c = (Background as SolidColorBrush).Color;
         }
         else if (Background is LinearGradientBrush)
         {
             c = (Background as LinearGradientBrush).GradientStops[0].Color;
         }
         else
         {
             return;
         }
         double opacity = 0.0004 * (765D - c.R - c.G - c.B) + 0.1;
         downRadius = 0.01 * (765D - c.R - c.G - c.B) + 3;
         if (Effect is DropShadowEffect)
         {
             DropShadowEffect effect = (Effect as DropShadowEffect);
             effect.Opacity    = opacity;
             effect.BlurRadius = downRadius;
         }
         Console.WriteLine(c + "," + downRadius + "," + opacity);
     }
 }
コード例 #27
0
        /* async void shitChristmas()
         * {
         *       DropShadowEffect effect = new DropShadowEffect();
         *
         *       ell.AsParallel().ForAll(x =>
         *       {
         *               x.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF1A66EA"));
         *       });
         *
         *       foreach (Ellipse ellipse in ell)
         *       {
         *               if (((SolidColorBrush)ellipse.Fill).Color == (Color)ColorConverter.ConvertFromString("#FFEAD71A"))
         *               {
         *                       for (float r = 243f, g = 215f, b = 263f; r > 26f & g > 102f & b > 234f; r -= 10.4f, g -= 5.65f, b -= 10.4f)
         *                       {
         *                               ellipse.Fill = new SolidColorBrush(Color.FromRgb((byte)r, (byte)g, (byte)b));
         *
         *                               effect.Color = Color.FromRgb((byte)r, (byte)g, (byte)b);
         *
         *                               await Task.Delay(15);
         *                       }
         *                       ellipse.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF1A66EA"));
         *               }
         *       }
         *       ell.Reverse();
         *       foreach (Ellipse ell in ell)
         *       {
         *               if (((SolidColorBrush)ell.Fill).Color == (Color)ColorConverter.ConvertFromString("#FF1A66EA"))
         *               {
         *
         *                       for (float r = 26f, g = 102f, b = 234f; r < 245f & g > 0f & b > 0f; r += 10.95f, g -= 5.1f, b += 12.25f)
         *                       {
         *                               ell.Fill = new SolidColorBrush(Color.FromRgb((byte)r, (byte)g, (byte)b));
         *                               effect.Color = Color.FromRgb((byte)r, (byte)g, (byte)b);
         *
         *                               await Task.Delay(15);
         *                       }
         *                       ell.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF1A66EA"));
         *               }
         *       }
         * }*/



        public void ChangeColor(Ellipse ellipse, int b)
        {
            var color            = changeColor[new Random().Next(b, changeColor.Length)];
            DropShadowEffect eff = new DropShadowEffect();

            eff.Color    = (Color)ColorConverter.ConvertFromString(color);
            ellipse.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));

            /*if (((SolidColorBrush)ellipse.Fill).Color == (Color)ColorConverter.ConvertFromString("#FF00FF0C"))
             * {
             *      ellipse.Fill = new SolidColorBrush(Color.FromRgb(234, 215, 26));
             * }
             * else if (((SolidColorBrush)ellipse.Fill).Color == (Color)ColorConverter.ConvertFromString("#FFEAD71A"))
             * {
             *      ellipse.Fill = new SolidColorBrush(Color.FromRgb(166, 0, 214));
             * }
             * else if (((SolidColorBrush)ellipse.Fill).Color == (Color)ColorConverter.ConvertFromString("#FFF50000"))
             * {
             *      ellipse.Fill = new SolidColorBrush(Color.FromRgb(0, 255, 12));
             * }
             * else if (((SolidColorBrush)ellipse.Fill).Color == (Color)ColorConverter.ConvertFromString("#FFA600D6"))
             * {
             *      ellipse.Fill = new SolidColorBrush(Color.FromRgb(0, 255, 12));
             * }*/
        }
コード例 #28
0
        private TextBlock Updater()
        {
            var textBlock = new TextBlock
            {
                Text                  = TextProducer(),
                FontFamily            = FontFamily,
                FontSize              = FontSize,
                FontWeight            = FontWeights.UltraBold,
                Foreground            = new SolidColorBrush(Color),
                RenderTransformOrigin = new Point(0.5, 0.5),
                IsHitTestVisible      = false,
                TextAlignment         = TextAlignment.Center
            };

            var dropShadowEffect = new DropShadowEffect
            {
                Color       = ShadowColor,
                BlurRadius  = 25,
                ShadowDepth = 0
            };

            textBlock.Effect          = dropShadowEffect;
            textBlock.RenderTransform = new ScaleTransform(1, 1);
            var textBlock1     = textBlock;
            var scaleTransform = new ScaleTransform(1, 1);

            textBlock1.RenderTransform = scaleTransform;

            return(textBlock1);
        }
コード例 #29
0
        public static DropShadowEffect GetDSE(int blurRadius, Color color, double opacity, Boolean isFrozen)
        {
            int hashKey = 3 * blurRadius.GetHashCode() + 5 * color.GetHashCode() + 7 * opacity.GetHashCode();

            if (!isFrozen || !_DSECache.ContainsKey(hashKey))
            {
                DropShadowEffect dse = new DropShadowEffect();
                dse.BlurRadius  = blurRadius;
                dse.Color       = color;
                dse.Opacity     = opacity;
                dse.ShadowDepth = 0;
                dse.Direction   = 0;
                if (!isFrozen)
                {
                    return(dse);
                }

                _DSECache[hashKey] = dse;
            }

            if (_DSECache[hashKey].CanFreeze)
            {
                _DSECache[hashKey].Freeze();
            }
            return(_DSECache[hashKey]);
        }
コード例 #30
0
 private void OkButton_Click(object sender, RoutedEventArgs e)
 {
     if (OutputWadPath.Trim().Length == 0)
     {
         MessageBox.Show(this, Properties.Resources.ErrorInvalidOuputWadFilenameStr, Properties.Resources.ErrorInvalidFilename, MessageBoxButton.OK, MessageBoxImage.Error);
         OutWadTextBox.ToolTip = Properties.Resources.ErrorInvalidOuputWadFilenameStr;
         DropShadowEffect effect = new DropShadowEffect {
             Color = Colors.Red, ShadowDepth = 0
         };
         OutWadTextBox.Effect = effect;
         return;
     }
     OutWadTextBox.Effect = null;
     if (OutputChannelId.Trim().Length != 4)
     {
         MessageBox.Show(this, Properties.Resources.ErrorChanIdMustBeFourStr, Properties.Resources.ErrorInvalidChanIdStr, MessageBoxButton.OK, MessageBoxImage.Error);
         ChanIDTextBox.ToolTip = Properties.Resources.ErrorChanIdMustBeFourStr;
         DropShadowEffect effect = new DropShadowEffect {
             Color = Colors.Red, ShadowDepth = 0
         };
         ChanIDTextBox.Effect = effect;
         return;
     }
     ChanIDTextBox.Effect = null;
     OutputChannelId      = OutputChannelId.Trim();
     DialogResult         = true;
 }