/// <summary> /// Defines a text style. /// </summary> /// <param name="fontStyle">The font style to use</param> /// <param name="foregroundColor">Foreground color</param> /// <param name="backgroundColor">Background clor</param> /// <param name="effect">Effect to use</param> /// <param name="effectColor">Effect color to use</param> public TextStyle(FontStyle fontStyle, Color foregroundColor, Color backgroundColor, EffectStyle effect, Color effectColor) { myFontStyle = fontStyle; myForegroundColor = foregroundColor; myBackgroundColor = backgroundColor; myEffect = effect; myEffectColor = effectColor; }
/// <summary> /// Defines a text style. /// </summary> /// <remarks> /// This contructor defines style with no effects. /// </remarks> /// <param name="fontStyle">The font style to use</param> /// <param name="foregroundColor">Foreground color</param> /// <param name="backgroundColor">Background clor</param> public TextStyle(FontStyle fontStyle, Color foregroundColor, Color backgroundColor) { myFontStyle = fontStyle; myForegroundColor = foregroundColor; myBackgroundColor = backgroundColor; myEffect = TextStyle.EffectStyle.None; myEffectColor = Color.Transparent; }
/// <summary> /// Sets new effect to a specified part of the text /// </summary> /// <param name="effect">The effect style to set</param> /// <param name="effectColor">The effect color to set</param> /// <param name="startOffset">Start offset of the block</param> /// <param name="length">Block length</param> /// <exception cref="ArgumentOutOfRangeException"><i>startOffset</i> is invalid in current string</exception> /// <exception cref="ArgumentOutOfRangeException"><i>length</i> is invalid starting with specified <i>startOffset</i></exception> public void SetStyle(TextStyle.EffectStyle effect, Color effectColor, int startOffset, int length) { foreach (RichString s in GetStringsInRange(startOffset, length)) { s.Style = new TextStyle(s.Style.FontStyle, s.Style.ForegroundColor, s.Style.BackgroundColor, effect, effectColor); } mySizeIsValid = false; }