本文整理汇总了C#中ScintillaNet.ScintillaControl.SetStyling方法的典型用法代码示例。如果您正苦于以下问题:C# ScintillaControl.SetStyling方法的具体用法?C# ScintillaControl.SetStyling怎么用?C# ScintillaControl.SetStyling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScintillaNet.ScintillaControl
的用法示例。
在下文中一共展示了ScintillaControl.SetStyling方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveHighlights
// <summary>
/// Removes the highlights from the correct sci control
/// </summary>
public static void RemoveHighlights(ScintillaControl sci)
{
Int32 es = sci.EndStyled;
Int32 mask = (1 << sci.StyleBits);
sci.StartStyling(0, mask);
sci.SetStyling(sci.TextLength, 0);
sci.StartStyling(es, mask - 1);
}
示例2: AddHighlights
//public static void AddHighlights(ScintillaControl sci, int posText, string textToHigh, System.Drawing.Color color)
//{
// //Int32 start = sci.MBSafePosition(posText);
// Int32 start = posText;
// Int32 end = start + sci.MBSafeTextLength(textToHigh);
// Int32 position = start;
// Int32 mask = 1 << sci.StyleBits;
// sci.SetIndicStyle(0, (Int32)IndicatorStyle.Plain);
// sci.SetIndicFore(0, DataConverter.ColorToInt32(color));
// sci.StartStyling(position, mask);
// sci.SetStyling(end - start, mask);
//}
public static void AddHighlights(ScintillaControl sci, Int32 posText, Int32 length, System.Drawing.Color color, IndicatorStyle indicator)
{
if (length == 0) return;
Int32 mask = 1 << sci.StyleBits;
sci.SetIndicStyle(0, (Int32)indicator);
sci.SetIndicFore(0, DataConverter.ColorToInt32(color));
sci.StartStyling(posText, mask);
sci.SetStyling(length, mask);
}
示例3: AddHighlights
/// <summary>
/// Adds highlights to the correct sci control
/// </summary>
private void AddHighlights(ScintillaControl sci, List<SearchMatch> matches)
{
ITabbedDocument doc = DocumentManager.FindDocument(sci);
Language language = MainForm.Instance.SciConfig.GetLanguage(sci.ConfigurationLanguage);
foreach (SearchMatch match in matches)
{
Int32 start = sci.MBSafePosition(match.Index);
Int32 end = start + sci.MBSafeTextLength(match.Value);
Int32 line = sci.LineFromPosition(start);
Int32 position = start;
Int32 es = sci.EndStyled;
Int32 mask = 1 << sci.StyleBits;
// Define indics in both controls...
doc.SplitSci1.SetIndicStyle(0, (Int32)ScintillaNet.Enums.IndicatorStyle.RoundBox);
doc.SplitSci1.SetIndicFore(0, language.editorstyle.HighlightBackColor);
doc.SplitSci2.SetIndicStyle(0, (Int32)ScintillaNet.Enums.IndicatorStyle.RoundBox);
doc.SplitSci2.SetIndicFore(0, language.editorstyle.HighlightBackColor);
sci.StartStyling(position, mask);
sci.SetStyling(end - start, mask);
sci.StartStyling(es, mask - 1);
}
}
示例4: AddHighlight
/// <summary>
/// Highlight a regexp match group
/// </summary>
/// <param name="sci"></param>
/// <param name="matches"></param>
private void AddHighlight(ScintillaControl sci, SearchMatch match)
{
Int32 start = sci.MBSafePosition(match.Index); // wchar to byte position
Int32 end = start + sci.MBSafeTextLength(match.Value); // wchar to byte text length
Int32 line = sci.LineFromPosition(start);
Int32 position = start;
Int32 es = sci.EndStyled;
Int32 mask = 1 << sci.StyleBits;
sci.SetIndicStyle(0, (Int32)ScintillaNet.Enums.IndicatorStyle.Max);
sci.SetIndicFore(0, 0xff0000);
sci.StartStyling(position, mask);
sci.SetStyling(end - start, mask);
sci.StartStyling(es, mask - 1);
}
示例5: RemoveHighlights
/// <summary>
/// Removes the highlights from the correct sci control
/// </summary>
private void RemoveHighlights(ScintillaControl sci)
{
Int32 es = sci.EndStyled;
Int32 mask = (1 << sci.StyleBits);
sci.StartStyling(0, mask);
sci.SetStyling(sci.TextLength, 0);
sci.StartStyling(es, mask - 1);
if (this.settingObject.addLineMarker)
{
sci.MarkerDeleteAll(2);
}
}
示例6: AddHighlights
/// <summary>
/// Adds highlights to the correct sci control
/// </summary>
private void AddHighlights(ScintillaControl sci, List<SearchMatch> matches)
{
if (matches == null)
{
return;
}
foreach (SearchMatch match in matches)
{
Int32 start = sci.MBSafePosition(match.Index);
Int32 end = start + sci.MBSafeTextLength(match.Value);
Int32 line = sci.LineFromPosition(start);
Int32 position = start;
Int32 es = sci.EndStyled;
Int32 mask = 1 << sci.StyleBits;
sci.SetIndicStyle(0, (Int32)ScintillaNet.Enums.IndicatorStyle.RoundBox);
sci.SetIndicFore(0, DataConverter.ColorToInt32(this.settingObject.highlightColor));
sci.StartStyling(position, mask);
sci.SetStyling(end - start, mask);
sci.StartStyling(es, mask - 1);
if (this.settingObject.addLineMarker)
{
sci.MarkerAdd(line, 2);
sci.MarkerSetBack(2, DataConverter.ColorToInt32(this.settingObject.highlightColor));
}
}
}
示例7: RemoveHighlights
/// <summary>
/// Removes the highlights from the correct sci control
/// </summary>
private void RemoveHighlights(ScintillaControl sci)
{
if (sci != null)
{
int es = sci.EndStyled;
int mask = 1 << sci.StyleBits;
sci.StartStyling(0, mask);
sci.SetStyling(sci.TextLength, 0);
sci.StartStyling(es, mask - 1);
if (settings.AddLineMarker) sci.MarkerDeleteAll(MARKER_NUMBER);
}
prevPos = -1;
prevToken = string.Empty;
prevResult = null;
}
示例8: AddHighlights
/// <summary>
/// Adds highlights to the correct sci control
/// </summary>
private void AddHighlights(ScintillaControl sci, List<SearchMatch> matches)
{
if (matches == null) return;
int style = (int)settings.HighlightStyle;
int color = DataConverter.ColorToInt32(settings.HighlightColor);
if (settings.HighlightUnderCursorEnabled && prevResult != null)
{
if (prevResult.IsPackage) color = DataConverter.ColorToInt32(settings.PackageColor);
else
{
FlagType flags;
if (prevResult.Type != null && prevResult.Member == null)
{
flags = prevResult.Type.Flags;
if ((flags & FlagType.Abstract) > 0) color = DataConverter.ColorToInt32(settings.AbstractColor);
else if ((flags & FlagType.TypeDef) > 0) color = DataConverter.ColorToInt32(settings.TypeDefColor);
else if ((flags & FlagType.Enum) > 0) color = DataConverter.ColorToInt32(settings.EnumColor);
else if ((flags & FlagType.Class) > 0) color = DataConverter.ColorToInt32(settings.ClassColor);
}
else if (prevResult.Member != null)
{
flags = prevResult.Member.Flags;
if ((flags & FlagType.Constant) > 0) color = DataConverter.ColorToInt32(settings.ConstantColor);
else if ((flags & FlagType.ParameterVar) > 0) color = DataConverter.ColorToInt32(settings.MemberFunctionColor);
else if ((flags & FlagType.LocalVar) > 0) color = DataConverter.ColorToInt32(settings.LocalVariableColor);
else if ((flags & FlagType.Static) == 0)
{
if ((flags & FlagType.Variable) > 0) color = DataConverter.ColorToInt32(settings.VariableColor);
else if ((flags & (FlagType.Setter | FlagType.Getter)) > 0) color = DataConverter.ColorToInt32(settings.AccessorColor);
else if ((flags & FlagType.Function) > 0) color = DataConverter.ColorToInt32(settings.MethodColor);
}
else
{
if ((flags & FlagType.Variable) > 0) color = DataConverter.ColorToInt32(settings.StaticVariableColor);
else if ((flags & (FlagType.Setter | FlagType.Getter)) > 0) color = DataConverter.ColorToInt32(settings.StaticAccessorColor);
else if ((flags & FlagType.Function) > 0) color = DataConverter.ColorToInt32(settings.StaticMethodColor);
}
}
}
}
int es = sci.EndStyled;
int mask = 1 << sci.StyleBits;
bool addLineMarker = settings.AddLineMarker;
foreach (SearchMatch match in matches)
{
int start = sci.MBSafePosition(match.Index);
int end = start + sci.MBSafeTextLength(match.Value);
int line = sci.LineFromPosition(start);
int position = start;
sci.SetIndicStyle(0, style);
sci.SetIndicFore(0, color);
sci.StartStyling(position, mask);
sci.SetStyling(end - start, mask);
sci.StartStyling(es, mask - 1);
if (addLineMarker)
{
sci.MarkerAdd(line, MARKER_NUMBER);
sci.MarkerSetBack(MARKER_NUMBER, color);
}
}
prevPos = sci.CurrentPos;
}