/// <summary> /// /// </summary> /// <param name="start"></param> /// <param name="length"></param> /// <param name="textStyle"></param> /// <returns>True if any character in the selection contains the text style. False otherwise.</returns> public bool HasStyle(int start, int length, TextStyle textStyle) => HasStyle(start, length, new TextStyle { Color = SelectionColor, FontStyle = SelectionFont.Style }, textStyle);
/// <summary> /// /// </summary> /// <param name="textStyle"></param> /// <returns>True if any character in the selection contains the text style. False otherwise.</returns> public bool HasStyle(TextStyle textStyle) => HasStyle(new TextStyle { Color = SelectionColor, FontStyle = SelectionFont.Style }, textStyle);
/// <summary> /// Removes the provided color and font style from the selection. /// </summary> /// <param name="textStyle"></param> public void RemoveStyle(TextStyle textStyle) => ApplyStyle(ForeColor, SelectionFont.Style & ~textStyle.FontStyle);
/// <summary> /// Swaps the font style from its current value. /// </summary> /// <param name="textStyle"></param> /// <param name="selectionOnly"></param> public void SwapStyle(TextStyle textStyle, bool selectionOnly = false) => ApplyStyle(SelectionFont.Style ^ textStyle.FontStyle, selectionOnly);
/// <summary> /// Styles the characters in the selection with the given style. /// </summary> /// <param name="style"></param> public void ApplyStyle(TextStyle style, bool selectionOnly = false) { SelectionColor = style.Color; SelectionFont = new Font(SelectionFont, style.FontStyle); SelectionOnly(selectionOnly); }