本文整理汇总了C#中ICSharpCode.AvalonEdit.Highlighting.HighlightingColor类的典型用法代码示例。如果您正苦于以下问题:C# HighlightingColor类的具体用法?C# HighlightingColor怎么用?C# HighlightingColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HighlightingColor类属于ICSharpCode.AvalonEdit.Highlighting命名空间,在下文中一共展示了HighlightingColor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: ApplyColorToElement
internal static void ApplyColorToElement(VisualLineElement element, HighlightingColor color, ITextRunConstructionContext context)
{
if (color.Foreground != null) {
Brush b = color.Foreground.GetBrush(context);
if (b != null)
element.TextRunProperties.SetForegroundBrush(b);
}
if (color.Background != null) {
Brush b = color.Background.GetBrush(context);
if (b != null)
element.BackgroundBrush = 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
));
}
if(color.Underline ?? false)
element.TextRunProperties.SetTextDecorations(TextDecorations.Underline);
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:24,代码来源:HighlightingColorizer.cs
示例17: IsEmptyColor
/// <summary>
/// Gets whether the color is empty (has no effect on a VisualLineTextElement).
/// For example, the C# "Punctuation" is an empty color.
/// </summary>
internal static bool IsEmptyColor(HighlightingColor color)
{
if (color == null)
return true;
return color.Background == null && color.Foreground == null
&& color.FontStyle == null && color.FontWeight == null
&& color.Underline == null;
}
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:12,代码来源:HighlightingColorizer.cs
示例18: CustomizeColor
internal static HighlightingColor CustomizeColor(HighlightingColor color, IEnumerable<CustomizedHighlightingColor> customizations)
{
if (color == null || color.Name == null)
return color;
return CustomizeColor(color.Name, customizations) ?? color;
}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:6,代码来源:CustomizableHighlightingColorizer.cs
示例19: CodeLanguageAHKv1
/// <summary>
/// Creates a new CodeLanguage Implementation for AHK v 1.1
/// </summary>
public CodeLanguageAHKv1()
: base("ahk-v1.1")
{
Name = "AHK v 1.1";
SELFREF_CAN_BE_OMITTED = false;
SUPPORTS_STARTUP_CODEDOCUMENT = true;
if(File.Exists(_settingsFilePath)){
_settings = SerializerHelper.DeserializeObjectFromFile<AHKSettings>(_settingsFilePath);
_settings.SettingsSerialisationPath = _settingsFilePath;
}else{
// load default settings
_settings = new AHKSettings(_settingsFilePath);
_settings.Save();
}
var viewmodelMapping = ServiceLocator.Instance.Resolve<IWorkBenchService>().MappingService;
viewmodelMapping.RegisterMapping(typeof(CodeLanguageSettingsViewModel), typeof(CodeLanguageSettingsView));
#region Define Language Syntax
// todo
// those data is actually thougt to be read out of confic files
//
this.LanguageKeywords.AddRange(new CodeKeyWord[]
{
new CodeKeyWord("if"), new CodeKeyWord("else"),
new CodeKeyWord("class"), new CodeKeyWord("new"), new CodeKeyWord("this"),new CodeKeyWord("base"), new CodeKeyWord("extends"),
new CodeKeyWord("return"), new CodeKeyWord("break"), new CodeKeyWord("continue"),
new CodeKeyWord("global"), new CodeKeyWord("static"), new CodeKeyWord("local"), new CodeKeyWord("byref"),
new CodeKeyWord("GoTo"), new CodeKeyWord("GoSub"),
new CodeKeyWord("loop"), new CodeKeyWord("for"), new CodeKeyWord("while"), new CodeKeyWord("in")
});
this.LanguageDirectives.AddRange(CodeLanguageAHKBuildinMethods.GetDirectives());
var buildins = CodeLanguageAHKBuildinMethods.ReadMembers();
BuildInMembers.AddRange(buildins);
#endregion
#region Load Syntax Definition of AHK
IHighlightingDefinition customHighlighting;
Brush b = new SolidColorBrush(Colors.GreenYellow);
var greenYellowBrush = new HighlightingBrushStaticColor(b);
var orangeBrush = new HighlightingBrushStaticColor(new SolidColorBrush(Colors.Orange));
var sr = new StreamReader(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Syntax\\Autohotkey.xshd"));
using(var reader = new XmlTextReader(sr)) {
customHighlighting = ICSharpCode.AvalonEdit.Highlighting.Xshd.
HighlightingLoader.Load(reader, HighlightingManager.Instance);
}
var commandColor = new HighlightingColor()
{
Foreground = orangeBrush,
FontWeight = FontWeights.Bold
};
var directiveColor = new HighlightingColor()
{
Foreground = greenYellowBrush
};
string regexstr = "";
foreach(var m in buildins) {
var command = m as CodeMemberMethodExAHK;
if(command != null && command.IsTraditionalCommand && !command.IsFlowCommand) {
//regexstr += command.Name.ToLowerInvariant() + "|";
// Add custom but static highligning rule
customHighlighting.MainRuleSet.Rules.Add(new HighlightingRule()
{
Color = commandColor,
Regex = GetRegexForCommand(command.Name.ToLowerInvariant())
});
}
}
HighlightingManager.Instance.RegisterHighlighting("ahk-v1.1", new string[] { ".ahk" }, customHighlighting);
#endregion
_emptyTemplate = new ProjectTemplateEmpty(this);
_templates = new ProjectTemplate[] { _emptyTemplate, new ProjectTemplateDemo(this) };
}
开发者ID:RaptorOne,项目名称:SmartDevelop,代码行数:91,代码来源:CodeLanguageAHKv1.cs
示例20: BeginSpan
/// <inheritdoc/>
public override void BeginSpan(HighlightingColor highlightingColor)
{
WriteIndentationAndSpace();
if (options.ColorNeedsSpanForStyling(highlightingColor)) {
htmlWriter.Write("<span");
options.WriteStyleAttributeForColor(htmlWriter, highlightingColor);
htmlWriter.Write('>');
endTagStack.Push("</span>");
} else {
endTagStack.Push(null);
}
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:13,代码来源:HtmlRichTextWriter.cs
注:本文中的ICSharpCode.AvalonEdit.Highlighting.HighlightingColor类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论