/// <summary> /// Set html syntax color text on the RTF html editor. /// </summary> private void SetColoredText(string text, bool color) { var selectionStart = _htmlEditor.CaretPosition; _htmlEditor.Text = color ? HtmlSyntaxHighlighter.Process(text) : text.Replace("\n", "\\par "); _htmlEditor.CaretPosition = selectionStart; }
/// <summary> /// Set html syntax color text on the RTF html editor. /// </summary> private void SetColoredText(string text) { var selectionStart = _htmlEditor.SelectionStart; _htmlEditor.Clear(); _htmlEditor.Rtf = HtmlSyntaxHighlighter.Process(text); _htmlEditor.SelectionStart = selectionStart; }
private void HtmlSourceForm_Load(object sender, EventArgs e) { richTextBox1.Rtf = HtmlSyntaxHighlighter.Process(richTextBox1.Text); }