本文整理汇总了C#中FastColoredTextBox.GetStylesOfChar方法的典型用法代码示例。如果您正苦于以下问题:C# FastColoredTextBox.GetStylesOfChar方法的具体用法?C# FastColoredTextBox.GetStylesOfChar怎么用?C# FastColoredTextBox.GetStylesOfChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FastColoredTextBox
的用法示例。
在下文中一共展示了FastColoredTextBox.GetStylesOfChar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cursorIsOnTextOfStyle
public static bool cursorIsOnTextOfStyle(Place place, Style style, FastColoredTextBox editor)
{
return editor.GetStylesOfChar(place).Contains(style);
}
示例2: SelectSameWords
//
// Select same words
//
public static void SelectSameWords(FastColoredTextBox tb)
{
//clear previously highlighted words on whole range
tb.Range.ClearStyle(SameWordsStyle);
if (!tb.Selection.IsEmpty) return; //user selected diapason
//get fragment around caret
var fragment = tb.Selection.GetFragment(@"\w");
string text = fragment.Text;
if (text.Length == 0) return;
//skip if style is a comment or string
foreach (Style s in tb.GetStylesOfChar(fragment.Start))
{
if (s == CommentStyle || s == StringStyle ||
s == HyperCommentStyle || s == CommentTagStyle)
{
return;
}
}
//highlight same words within visible range
List<Range> ranges = new List<Range>(tb.VisibleRange.GetRanges(@"\b" + text + @"\b"));
if (ranges.Count > 1) //if more than one word exist
{
foreach (Range r in ranges)
{
r.SetStyle(HighlightSyntax.SameWordsStyle);
}
}
}