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


C# Highlighting.HighlightingColor类代码示例

本文整理汇总了C#中ICSharpCode.AvalonEdit.Highlighting.HighlightingColor的典型用法代码示例。如果您正苦于以下问题:C# HighlightingColor类的具体用法?C# HighlightingColor怎么用?C# HighlightingColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HighlightingColor类属于ICSharpCode.AvalonEdit.Highlighting命名空间,在下文中一共展示了HighlightingColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyColorToElement

 /// <summary>
 /// Applies a highlighting color to a visual line element.
 /// </summary>
 protected virtual void ApplyColorToElement(VisualLineElement element, HighlightingColor color)
 {
     if (color.Foreground != null)
     {
         Brush b = color.Foreground.GetBrush(CurrentContext);
         if (b != null)
             element.TextRunProperties.SetForegroundBrush(b);
     }
     if (color.Background != null)
     {
         Brush b = color.Background.GetBrush(CurrentContext);
         if (b != null)
             element.TextRunProperties.SetBackgroundBrush(b);
     }
     if (color.FontStyle != null || color.FontWeight != null)
     {
         Typeface tf = element.TextRunProperties.Typeface;
         element.TextRunProperties.SetTypeface(new Typeface(
             tf.FontFamily,
             color.FontStyle ?? tf.Style,
             color.FontWeight ?? tf.Weight,
             tf.Stretch
         ));
     }
 }
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:28,代码来源:HighlightingColorizer.cs

示例2: RichText

		internal RichText(string text, int[] offsets, HighlightingColor[] states)
		{
			this.text = text;
			Debug.Assert(offsets[0] == 0);
			Debug.Assert(offsets.Last() <= text.Length);
			this.stateChangeOffsets = offsets;
			this.stateChanges = states;
		}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:8,代码来源:RichText.cs

示例3: OnThemeUpdated

		static void OnThemeUpdated() {
			var theme = dntheme.Themes.Theme;
			CodeBreakpointHighlightingColor = theme.GetColor(dntheme.ColorType.BreakpointStatement).TextInheritedColor;
			CodeBreakpointDisabledHighlightingColor = theme.GetColor(dntheme.ColorType.DisabledBreakpointStatement).TextInheritedColor;
			StackFrameCurrentHighlightingColor = theme.GetColor(dntheme.ColorType.CurrentStatement).TextInheritedColor;
			StackFrameReturnHighlightingColor = theme.GetColor(dntheme.ColorType.ReturnStatement).TextInheritedColor;
			StackFrameSelectedHighlightingColor = theme.GetColor(dntheme.ColorType.SelectedReturnStatement).TextInheritedColor;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:8,代码来源:DebuggerColors.cs

示例4: OnThemeUpdated

		void OnThemeUpdated(IThemeManager themeManager) {
			var theme = themeManager.Theme;
			CodeBreakpointHighlightingColor = theme.GetTextColor(ColorType.BreakpointStatement).ToHighlightingColor();
			CodeBreakpointDisabledHighlightingColor = theme.GetTextColor(ColorType.DisabledBreakpointStatement).ToHighlightingColor();
			StackFrameCurrentHighlightingColor = theme.GetTextColor(ColorType.CurrentStatement).ToHighlightingColor();
			StackFrameReturnHighlightingColor = theme.GetTextColor(ColorType.ReturnStatement).ToHighlightingColor();
			StackFrameSelectedHighlightingColor = theme.GetTextColor(ColorType.SelectedReturnStatement).ToHighlightingColor();
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:8,代码来源:DebuggerColors.cs

示例5: AddRule

 public HighlightingDefinition AddRule(string expression, HighlightingColor color)
 {
     var rule = new HighlightingRule
     {
         Regex = expression.ToRegex(),
         Color = color
     };
     return AddRule(rule);
 }
开发者ID:testpulse,项目名称:Pickle-Studio,代码行数:9,代码来源:HighlightingDefinition.cs

示例6: WriteStyleAttributeForColor

		/// <summary>
		/// Writes the HTML attribute for the style to the text writer.
		/// </summary>
		public virtual void WriteStyleAttributeForColor(TextWriter writer, HighlightingColor color)
		{
			if (writer == null)
				throw new ArgumentNullException("writer");
			if (color == null)
				throw new ArgumentNullException("color");
			writer.Write(" style=\"");
			WebUtility.HtmlEncode(color.ToCss(), writer);
			writer.Write('"');
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:13,代码来源:HtmlOptions.cs

示例7: SearchResultMatch

		public SearchResultMatch(FileName fileName, Location startLocation, Location endLocation, int offset, int length, HighlightedInlineBuilder builder, HighlightingColor defaultTextColor)
		{
			this.fileName = fileName;
			this.startLocation = startLocation;
			this.endLocation = endLocation;
			this.offset = offset;
			this.length = length;
			this.builder = builder;
			this.defaultTextColor = defaultTextColor;
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:10,代码来源:SearchResultMatch.cs

示例8: GetColor

        protected HighlightingColor GetColor()
        {
            var color = new HighlightingColor();

            color.Foreground = GetForeground();
            color.FontWeight = GetFontWeight();
            color.FontStyle = GetFontStyle();
            color.Name = Name;

            return color;
        }
开发者ID:anaimi,项目名称:farawla,代码行数:11,代码来源:Syntax.cs

示例9: SearchResultMatch

		public SearchResultMatch(FileName fileName, TextLocation startLocation, TextLocation endLocation, int offset, int length, RichText displayText, HighlightingColor defaultTextColor)
		{
			if (fileName == null)
				throw new ArgumentNullException("fileName");
			this.fileName = fileName;
			this.startLocation = startLocation;
			this.endLocation = endLocation;
			this.offset = offset;
			this.length = length;
			this.displayText = displayText;
			this.defaultTextColor = defaultTextColor;
		}
开发者ID:asiazhang,项目名称:SharpDevelop,代码行数:12,代码来源:SearchResultMatch.cs

示例10: ToHighlightingColor

 /// <summary>
 /// Converts <paramref name="self"/> to a <see cref="HighlightingColor"/> instance or null
 /// if input is null
 /// </summary>
 /// <param name="self">This</param>
 /// <returns></returns>
 public static HighlightingColor ToHighlightingColor(this IThemeColor self)
 {
     if (self == null)
         return null;
     var hl = new HighlightingColor {
         Name = self.Name,
         FontWeight = self.FontWeight,
         FontStyle = self.FontStyle,
         Underline = null,
         Foreground = MyHighlightingBrush.Create(self.Foreground),
         Background = MyHighlightingBrush.Create(self.Background),
     };
     hl.Freeze();
     return hl;
 }
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:21,代码来源:ExtensionMethods.cs

示例11: SetHighlighting

		/// <summary>
		/// Applies the properties from the HighlightingColor to the specified text segment.
		/// </summary>
		public void SetHighlighting(int offset, int length, HighlightingColor color)
		{
			if (color == null)
				throw new ArgumentNullException("color");
			int startIndex = GetIndexForOffset(offset);
			int endIndex = GetIndexForOffset(offset + length);
			for (int i = startIndex; i < endIndex; i++) {
				HighlightingState state = stateChanges[i];
				if (color.Foreground != null)
					state.Foreground = color.Foreground.GetBrush(null);
				if (color.FontStyle != null)
					state.Style = color.FontStyle;
				if (color.FontWeight != null)
					state.Weight = color.FontWeight;
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:19,代码来源:HighlightedInlineBuilder.cs

示例12: SetHighlighting

		/// <summary>
		/// Applies the properties from the HighlightingColor to the specified text segment.
		/// </summary>
		public void SetHighlighting(int offset, int length, HighlightingColor color)
		{
			if (color == null)
				throw new ArgumentNullException("color");
			if (color.Foreground == null && color.FontStyle == null && color.FontWeight == null) {
				// Optimization: don't split the HighlightingState when we're not changing
				// any property. For example, the "Punctuation" color in C# is
				// empty by default.
				return;
			}
			int startIndex = GetIndexForOffset(offset);
			int endIndex = GetIndexForOffset(offset + length);
			for (int i = startIndex; i < endIndex; i++) {
				HighlightingState state = stateChanges[i];
				if (color.Foreground != null)
					state.Foreground = color.Foreground.GetBrush(null);
				if (color.FontStyle != null)
					state.Style = color.FontStyle;
				if (color.FontWeight != null)
					state.Weight = color.FontWeight;
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:25,代码来源:HighlightedInlineBuilder.cs

示例13: ApplyColorToElement

 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));
   }
 }
开发者ID:rsdn,项目名称:nitra,代码行数:24,代码来源:NitraTextEditor.cs

示例14: ApplyHighlighting

		/// <summary>
		/// Applies the HighlightingColor to the specified range of text.
		/// If the color specifies <c>null</c> for some properties, existing highlighting is preserved.
		/// </summary>
		public void ApplyHighlighting(int offset, int length, HighlightingColor color)
		{
			if (color == null || color.IsEmptyForMerge) {
				// Optimization: don't split the HighlightingState when we're not changing
				// any property. For example, the "Punctuation" color in C# is
				// empty by default.
				return;
			}
			int startIndex = GetIndexForOffset(offset);
			int endIndex = GetIndexForOffset(offset + length);
			for (int i = startIndex; i < endIndex; i++) {
				stateChanges[i].MergeWith(color);
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:18,代码来源:RichTextModel.cs

示例15: Append

		/// <summary>
		/// Appends another RichTextModel after this one.
		/// </summary>
		internal void Append(int offset, int[] newOffsets, HighlightingColor[] newColors)
		{
			Debug.Assert(newOffsets.Length == newColors.Length);
			Debug.Assert(newOffsets[0] == 0);
			// remove everything before offset:
			while (stateChangeOffsets.Count > 0 && stateChangeOffsets.Last() <= offset) {
				stateChangeOffsets.RemoveAt(stateChangeOffsets.Count - 1);
				stateChanges.RemoveAt(stateChanges.Count - 1);
			}
			// Append the new segments
			for (int i = 0; i < newOffsets.Length; i++) {
				stateChangeOffsets.Add(offset + newOffsets[i]);
				stateChanges.Add(newColors[i]);
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:18,代码来源:RichTextModel.cs


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