当前位置: 首页>>代码示例>>C#>>正文


C# Brush.CloneCurrentValue方法代码示例

本文整理汇总了C#中System.Windows.Media.Brush.CloneCurrentValue方法的典型用法代码示例。如果您正苦于以下问题:C# Brush.CloneCurrentValue方法的具体用法?C# Brush.CloneCurrentValue怎么用?C# Brush.CloneCurrentValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Media.Brush的用法示例。


在下文中一共展示了Brush.CloneCurrentValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateNodeBrushes

        public void UpdateNodeBrushes(Brush brush, Dictionary<int, List<SankeyNode>> nodes)
        {
            if(diagram == null || brush == null || nodes == null || nodes.Count < 2)
            {
                return;
            }

            if(diagram.UsePallette == SankeyPalette.NodesLinks)
            {
                return;
            }

            ResetHighlight();

            foreach(var levelNodes in nodes.Values)
            {
                foreach(var node in levelNodes)
                {
                    node.Shape.Fill = brush.CloneCurrentValue();
                }
            }
        }
开发者ID:ZoeCheck,项目名称:SankeyDiagram,代码行数:22,代码来源:SankeyStyleManager.cs

示例2: RandomizeBrush

        public static Brush RandomizeBrush(Brush brush)
        {
            if (brush is SolidColorBrush)
            {
                return new SolidColorBrush(GetRandomRainbowMediaColor());
            }

            if (brush is LinearGradientBrush)
            {
                var randomBrush = (LinearGradientBrush) brush.CloneCurrentValue();
                var rand = GetRandomRainbowMediaColor();
                foreach (var stop in randomBrush.GradientStops)
                    stop.Color = System.Windows.Media.Color.FromArgb(stop.Color.A, rand.R, rand.G, rand.B);

                return randomBrush;
            }

            if (brush is RadialGradientBrush)
            {
                var randomBrush = (RadialGradientBrush) brush.CloneCurrentValue();
                var rand = GetRandomRainbowMediaColor();
                foreach (var stop in randomBrush.GradientStops)
                    stop.Color = System.Windows.Media.Color.FromArgb(stop.Color.A, rand.R, rand.G, rand.B);

                return randomBrush;
            }

            return brush;
        }
开发者ID:SpoinkyNL,项目名称:Artemis,代码行数:29,代码来源:ColorHelpers.cs

示例3: Initialize


//.........这里部分代码省略.........

            Window_TitleGrid.ClipToBounds = true;
            Window_TitleGrid.Height = TITLE_BAR_HEIGHT;
            Window_TitleGrid.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            Window_TitleGrid.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            Window_TitleGrid.Children.Add(TitleIcon);
            Window_TitleGrid.Children.Add(Window_TitleLabel);
            Window_TitleGrid.Children.Add(Window_Button_Close);
            Window_TitleGrid.Children.Add(Window_Button_Maximize);
            Window_TitleGrid.Children.Add(Window_Button_Minimize);

            Window_TitleLabel.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            Window_TitleLabel.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            Window_TitleLabel.Height = TITLE_BAR_HEIGHT - 2;
            Window_TitleLabel.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;
            Window_TitleLabel.Margin = new Thickness(30, 0, 140, 0);
            Window_TitleLabel.Foreground = Brushes.White;

            Window_Button_Close.MouseEnter += Window_Button_MouseEnter;
            Window_Button_Close.MouseLeave += Window_Button_MouseLeave;
            Window_Button_Close.Click += Window_Close;
            Window_Button_Close.Content = 'r';
            Window_Button_Close.FontFamily = new System.Windows.Media.FontFamily("Webdings");
            Window_Button_Close.FontSize = 11;
            Window_Button_Close.Height = 19;
            Window_Button_Close.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            Window_Button_Close.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            Window_Button_Close.Padding = new Thickness(0, -CHROME_BUTTON_TOP_MARGIN - 1, 0, 0);
            Window_Button_Close.Foreground = Brushes.Black;
            Window_Button_Close.BorderThickness = new Thickness(1);
            Window_Button_Close.FontWeight = FontWeights.Bold;
            Window_Button_Close.Width = X_BUTTON_NORMAL_WIDTH;
            Window_Button_Close.Margin = new Thickness(0, CHROME_BUTTON_TOP_MARGIN, 5, 0);
            Window_Button_Close.Focusable = false;
            WindowChrome.SetIsHitTestVisibleInChrome(Window_Button_Close, true);

            Window_Button_Maximize.MouseEnter += Window_Button_MouseEnter;
            Window_Button_Maximize.MouseLeave += Window_Button_MouseLeave;
            Window_Button_Maximize.Click += Window_MaximizeRestore;
            Window_Button_Maximize.Content = '1';
            Window_Button_Maximize.FontFamily = new System.Windows.Media.FontFamily("Webdings");
            Window_Button_Maximize.FontSize = 11;
            Window_Button_Maximize.Height = 19;
            Window_Button_Maximize.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            Window_Button_Maximize.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            Window_Button_Maximize.Padding = new Thickness(0, -CHROME_BUTTON_TOP_MARGIN - 1, 0, 0);
            Window_Button_Maximize.Foreground = Brushes.Black;
            Window_Button_Maximize.BorderThickness = new Thickness(1);
            Window_Button_Maximize.FontWeight = FontWeights.Bold;
            Window_Button_Maximize.Width = 30;
            Window_Button_Maximize.Margin = new Thickness(0, CHROME_BUTTON_TOP_MARGIN, 52, 0);
            Window_Button_Maximize.Focusable = false;
            WindowChrome.SetIsHitTestVisibleInChrome(Window_Button_Maximize, true);

            Window_Button_Minimize.MouseEnter += Window_Button_MouseEnter;
            Window_Button_Minimize.MouseLeave += Window_Button_MouseLeave;
            Window_Button_Minimize.Click += Window_Minimize;
            Window_Button_Minimize.Content = '0';
            Window_Button_Minimize.FontFamily = new System.Windows.Media.FontFamily("Webdings");
            Window_Button_Minimize.FontSize = 11;
            Window_Button_Minimize.Height = 19;
            Window_Button_Minimize.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            Window_Button_Minimize.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            Window_Button_Minimize.Padding = new Thickness(0, -CHROME_BUTTON_TOP_MARGIN - 1, 0, 0);
            Window_Button_Minimize.Foreground = Brushes.Black;
            Window_Button_Minimize.BorderThickness = new Thickness(1);
            Window_Button_Minimize.FontWeight = FontWeights.Bold;
            Window_Button_Minimize.Width = 30;
            Window_Button_Minimize.Margin = new Thickness(0, CHROME_BUTTON_TOP_MARGIN, 81, 0);
            Window_Button_Minimize.Focusable = false;
            WindowChrome.SetIsHitTestVisibleInChrome(Window_Button_Minimize, true);

            #endregion

            #region COLOR_PICKER
            foreach (ThemeColors t in AvailableThemeColors)
            {
                MenuItem NewItem = new MenuItem();
                NewItem.Header = t;
                NewItem.Click += (o, e) =>
                {
                    ThemeColor = (ThemeColors)((MenuItem)e.Source).Header;
                };
                ColorPicker.Items.Add(NewItem);
            }
            //Window_TitleGrid.ContextMenu = ColorPicker;
            #endregion

            Window_Button_Close.Style = (Style)this.FindResource("Window_Button_Close");
            Window_Button_Maximize.Style = (Style)this.FindResource("Window_Button_Maximize");
            Window_Button_Minimize.Style = (Style)this.FindResource("Window_Button_Minimize");
            Window_TitleGrid.Style = (Style)this.FindResource("Window_Frame_Title_Bar");
            Window_Border.Style = (Style)this.FindResource("Window_Frame_Border");

            TitleEnabledBackground = Window_TitleGrid.Background.CloneCurrentValue();
            TitleDisabledBackground = TitleEnabledBackground.CloneCurrentValue();
            TitleDisabledBackground.Opacity = 0.4;
            TitleEnabledBackground.Freeze();
            TitleDisabledBackground.Freeze();
        }
开发者ID:kazelone,项目名称:ExpressionWindow,代码行数:101,代码来源:ExpressionWindow.cs


注:本文中的System.Windows.Media.Brush.CloneCurrentValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。