コード例 #1
0
 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));
     }
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
 void ApplyChanges(VisualLineElement element)
 {
     element.TextRunProperties.SetForegroundBrush(Brushes.Black);
     element.TextRunProperties.SetBackgroundBrush(Brushes.Red);
 }
コード例 #5
0
 void ApplyChanges(VisualLineElement element)
 {
     // apply changes here
     element.TextRunProperties.SetForegroundBrush(color);
 }
コード例 #6
0
 void ApplyChanges(VisualLineElement element)
 {
     // This is where you do anything with the line
     element.TextRunProperties.SetForegroundBrush(Brush);
 }
コード例 #7
0
 void HighlightNamespaceDeclaration(VisualLineElement element)
 {
     element.TextRunProperties.SetForegroundBrush(XamlBindingOptions.NamespaceDeclarationForegroundColor.ToBrush());
     element.TextRunProperties.SetBackgroundBrush(XamlBindingOptions.NamespaceDeclarationBackgroundColor.ToBrush());
 }
コード例 #8
0
 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);
 }
コード例 #9
0
 public void Apply(VisualLineElement element, Expression item)
 {
 }
コード例 #10
0
 void ApplyChanges(VisualLineElement element)
 {
     element.TextRunProperties.SetForegroundBrush(_greenBrush);
 }
コード例 #11
0
 public void Applyer(VisualLineElement element)
 {
     element.BackgroundBrush = _brush;
 }
コード例 #12
0
ファイル: ColorizeAvalonEdit.cs プロジェクト: VE-2016/VE-2016
 private void ApplyChangesForUsing(VisualLineElement element)
 {
     element.TextRunProperties.SetForegroundBrush(Brushes.Black);
 }
コード例 #13
0
ファイル: ColorizeAvalonEdit.cs プロジェクト: VE-2016/VE-2016
 private void ApplyChanges(VisualLineElement element)
 {
     element.TextRunProperties.SetForegroundBrush(Brushes.Gray);
 }
コード例 #14
0
 private void HighlightParticipant(VisualLineElement visualLineElement)
 {
     visualLineElement.TextRunProperties.SetForegroundBrush(Brushes.Green);
 }
コード例 #15
0
 void visualLineElementAction(VisualLineElement el)
 {
 }
コード例 #16
0
 protected void ApplyChanges(VisualLineElement element)
 {
     element.BackgroundBrush = Brushes.Gold;
     element.TextRunProperties.SetForegroundBrush(Brushes.Red);
     //element.TextRunProperties.SetBackgroundBrush(Brushes.Gold);
 }
コード例 #17
0
ファイル: LineColorizer.cs プロジェクト: hong-sh/VisualZoom
 void ApplyChanges2(VisualLineElement element)
 {
     element.TextRunProperties.SetBackgroundBrush(Brushes.Transparent);
 }
コード例 #18
0
ファイル: Imla.cs プロジェクト: yeganaaa/UyghurEditPP
 void ApplyChanges(VisualLineElement element)
 {
     element.TextRunProperties.SetTextDecorations(gCollection);
 }
コード例 #19
0
 /// <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);
 }
コード例 #20
0
ファイル: Imla.cs プロジェクト: yeganaaa/UyghurEditPP
 void HilightSelection(VisualLineElement element)
 {
     element.TextRunProperties.SetBackgroundBrush(Brushes.Yellow);
 }
コード例 #21
0
 void HighlightIgnored(VisualLineElement element)
 {
     element.TextRunProperties.SetForegroundBrush(XamlBindingOptions.IgnoredForegroundColor.ToBrush());
     element.TextRunProperties.SetBackgroundBrush(XamlBindingOptions.IgnoredBackgroundColor.ToBrush());
 }
コード例 #22
0
ファイル: HighlightErrorLine.cs プロジェクト: xwiz/FastSharp
 private void HighlightError(VisualLineElement visualLineElement)
 {
     visualLineElement.TextRunProperties.SetBackgroundBrush(Brushes.PaleVioletRed);
 }
コード例 #23
0
 /// <summary>
 /// Applies a highlighting color to a visual line element.
 /// </summary>
 protected virtual void ApplyColorToElement(VisualLineElement element, HighlightingColor color)
 {
     ApplyColorToElement(element, color, CurrentContext);
 }
コード例 #24
0
 void ApplyChanges(VisualLineElement element)
 {
     // apply changes here
     element.TextRunProperties.SetBackgroundBrush(Brushes.Yellow);
 }