Beispiel #1
0
    /// <summary>Begin a span of text in the specified <paramref name="style" /> .</summary>
    /// <param name="output">Output destination.</param>
    /// <param name="style">Style to apply.</param>
    private void Set(RichTextBox output, RichTextThemeStyle style)
    {
        if (output is null)
        {
            throw new ArgumentNullException(nameof(output));
        }

        if (!this.styles.TryGetValue(style, out var wcts))
        {
            return;
        }

        if (wcts.Foreground.HasValue)
        {
            output.SelectionColor = wcts.Foreground.Value;
        }

        if (wcts.Background.HasValue)
        {
            output.SelectionBackColor = wcts.Background.Value;
        }
    }
Beispiel #2
0
    internal StyleReset Apply(RichTextBox output, RichTextThemeStyle style)
    {
        this.Set(output, style);

        return(new StyleReset(output));
    }