private void ApplyColorToElement(VisualLineElement element, HighlightingColor color) { if (color.Foreground != null) { Brush brush = color.Foreground.GetBrush(base.CurrentContext); if (brush != null) { element.TextRunProperties.SetForegroundBrush(brush); } } if (color.Background != null) { Brush brush2 = color.Background.GetBrush(base.CurrentContext); if (brush2 != null) { element.TextRunProperties.SetBackgroundBrush(brush2); } } if (color.FontStyle.HasValue || color.FontWeight.HasValue) { Typeface typeface = element.TextRunProperties.Typeface; element.TextRunProperties.SetTypeface(new Typeface(typeface.FontFamily, color.FontStyle ?? typeface.Style, color.FontWeight ?? typeface.Weight, typeface.Stretch)); } }
private static void ApplyHighlight(VisualLineElement element, Highlight highlight, double magnify) { var trp = element.TextRunProperties; var foregroundBrush = ColorBrush(highlight.Foreground); if (foregroundBrush != null) { trp.SetForegroundBrush(foregroundBrush); } var backgroundBrush = ColorBrush(highlight.Background); if (backgroundBrush != null) { trp.SetBackgroundBrush(backgroundBrush); } if (!string.IsNullOrWhiteSpace(highlight.FontWeight) || !string.IsNullOrWhiteSpace(highlight.FontStyle)) { var tf = trp.Typeface; var weight = ConvertFontWeight(highlight.FontWeight) ?? tf.Weight; var style = ConvertFontStyle(highlight.FontStyle) ?? tf.Style; var typeFace = new Typeface(tf.FontFamily, style, weight, tf.Stretch); trp.SetTypeface(typeFace); } if (highlight.Underline) { trp.SetTextDecorations(TextDecorations.Underline); } if (double.IsNaN(magnify) == false) { trp.SetFontRenderingEmSize(trp.FontRenderingEmSize * magnify); } }
private void ColorizeElement(VisualLineElement element, Token token, bool isAttribute) { switch (token.Type) { case TokenType.Comment: element.TextRunProperties.SetForegroundBrush(Brushes.ForestGreen); break; case TokenType.AngularLeft: case TokenType.AngularRight: case TokenType.TagCloserLeft: case TokenType.TagCloserRight: case TokenType.PrologClose: case TokenType.PrologOpen: element.TextRunProperties.SetForegroundBrush(Brushes.Blue); break; case TokenType.String: element.TextRunProperties.SetForegroundBrush(Brushes.Orange); break; case TokenType.Id: var tf = element.TextRunProperties.Typeface; element.TextRunProperties.SetTypeface(new Typeface( tf.FontFamily, FontStyles.Italic, FontWeights.Bold, FontStretches.Condensed)); if (!isAttribute) { element.TextRunProperties.SetForegroundBrush(Brushes.BlueViolet); } else { element.TextRunProperties.SetForegroundBrush(Brushes.Coral); } break; } }
void ApplyChanges(VisualLineElement element) { element.TextRunProperties.SetForegroundBrush(Brushes.Black); element.TextRunProperties.SetBackgroundBrush(Brushes.Red); }
void ApplyChanges(VisualLineElement element) { // apply changes here element.TextRunProperties.SetForegroundBrush(color); }
void ApplyChanges(VisualLineElement element) { // This is where you do anything with the line element.TextRunProperties.SetForegroundBrush(Brush); }
void HighlightNamespaceDeclaration(VisualLineElement element) { element.TextRunProperties.SetForegroundBrush(XamlBindingOptions.NamespaceDeclarationForegroundColor.ToBrush()); element.TextRunProperties.SetBackgroundBrush(XamlBindingOptions.NamespaceDeclarationBackgroundColor.ToBrush()); }
void ApplyChanges(VisualLineElement element) { element.TextRunProperties.SetBackgroundBrush(new SolidColorBrush(Color.FromArgb(128, 255, 200, 200))); // This is where you do anything with the line //element.TextRunProperties.SetForegroundBrush(Brushes.Red); }
public void Apply(VisualLineElement element, Expression item) { }
void ApplyChanges(VisualLineElement element) { element.TextRunProperties.SetForegroundBrush(_greenBrush); }
public void Applyer(VisualLineElement element) { element.BackgroundBrush = _brush; }
private void ApplyChangesForUsing(VisualLineElement element) { element.TextRunProperties.SetForegroundBrush(Brushes.Black); }
private void ApplyChanges(VisualLineElement element) { element.TextRunProperties.SetForegroundBrush(Brushes.Gray); }
private void HighlightParticipant(VisualLineElement visualLineElement) { visualLineElement.TextRunProperties.SetForegroundBrush(Brushes.Green); }
void visualLineElementAction(VisualLineElement el) { }
protected void ApplyChanges(VisualLineElement element) { element.BackgroundBrush = Brushes.Gold; element.TextRunProperties.SetForegroundBrush(Brushes.Red); //element.TextRunProperties.SetBackgroundBrush(Brushes.Gold); }
void ApplyChanges2(VisualLineElement element) { element.TextRunProperties.SetBackgroundBrush(Brushes.Transparent); }
void ApplyChanges(VisualLineElement element) { element.TextRunProperties.SetTextDecorations(gCollection); }
/// <summary> /// Applies a highlighting color to a visual line element. /// </summary> protected virtual void ApplyColorToElement(VisualLineElement element, HighlightingColor color) { element.TextRunProperties = color.Apply(element.TextRunProperties); }
void HilightSelection(VisualLineElement element) { element.TextRunProperties.SetBackgroundBrush(Brushes.Yellow); }
void HighlightIgnored(VisualLineElement element) { element.TextRunProperties.SetForegroundBrush(XamlBindingOptions.IgnoredForegroundColor.ToBrush()); element.TextRunProperties.SetBackgroundBrush(XamlBindingOptions.IgnoredBackgroundColor.ToBrush()); }
private void HighlightError(VisualLineElement visualLineElement) { visualLineElement.TextRunProperties.SetBackgroundBrush(Brushes.PaleVioletRed); }
/// <summary> /// Applies a highlighting color to a visual line element. /// </summary> protected virtual void ApplyColorToElement(VisualLineElement element, HighlightingColor color) { ApplyColorToElement(element, color, CurrentContext); }
void ApplyChanges(VisualLineElement element) { // apply changes here element.TextRunProperties.SetBackgroundBrush(Brushes.Yellow); }