internal void LoadSysParams() { PropertyInfo[] infos = typeof(Brushes).GetProperties(); List <BrushInfo> BrushArray = new List <BrushInfo>(); foreach (PropertyInfo f in infos) { SolidColorBrush brush = (SolidColorBrush)f.GetValue(null, null); brush.Freeze(); if (brush.Equals(Brushes.Transparent)) { continue; } BrushInfo bi = new BrushInfo(); bi.Name = f.Name; bi.CurBrush = brush; BrushArray.Add(bi); } SystemParams.AllBrushes = BrushArray.ToArray(); }
private static void EditingCommandsEx_SelectBackgroundColor_Executed(Object sender, ExecutedRoutedEventArgs e) { var editor = sender as RichTextBox; Color?color = RichTextBoxToolBarHelper.GetSelectionColor(e.Parameter, Colors.White); if (e.Handled = (editor != null && color != null)) { RichTextBoxToolBarHelper.ApplyNewValueToFormattingProperty <SolidColorBrush>( editor.Selection, TextElement.BackgroundProperty, new SolidColorBrush((Color)color), (item1, item2) => SolidColorBrush.Equals(item1, item2)); } }
private void ShowAnimate(SolidColorBrush brush = null) { Visibility = Visibility.Visible; var animation = new ThicknessAnimation(); animation.Duration = new Duration(TimeSpan.FromMilliseconds(180)); animation.To = new Thickness(0, 0, 0, 0); mainGrid.BeginAnimation(MarginProperty, animation); if (brush != null && !brush.Equals(RowBackground)) { RowBackground = new SolidColorBrush(((RowBackground as SolidColorBrush)?.Color ?? Colors.DarkSlateBlue)); var brushAnimation = new ColorAnimation(); brushAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(250)); brushAnimation.To = brush.Color; RowBackground.BeginAnimation(SolidColorBrush.ColorProperty, brushAnimation); } }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if (value is SolidColorBrush) { SolidColorBrush scbrush = (SolidColorBrush)(value); if (scbrush.Equals(Brushes.Blue)) { return(true); } else { return(false); } } else { return(false); } }
private static bool IsDefaultColor(SolidColorBrush color) => !(color.Equals(FieldColorHelper.GoodFieldColor) || color.Equals(FieldColorHelper.BadFieldColor));
public void SwitchSplineColor_2() { SPLINE_COLOR_2 = SPLINE_COLOR_2.Equals(SPLINE_COLOR_2_A) ? SPLINE_COLOR_2_B : SPLINE_COLOR_2_A; }
public void SwitchSplineColor_1() { SPLINE_COLOR_1 = SPLINE_COLOR_1.Equals(SPLINE_COLOR_1_A) ? SPLINE_COLOR_1_B : SPLINE_COLOR_1_A; }