Hello.
I wanted to implement such a function so that in the handler for clicking on a button, a certain text was displayed in richTextBox, while one word from this text was painted in a certain color, and the rest went in the usual color.
private void PersonShow_Click(object sender, EventArgs e) { string result = classArray[0].Show(); rText.Text += "Person:" + result + "\n"; // rText.SelectionLength = 7; // rText.SelectionColor = Color.DarkCyan; }
2 lines I commented out. I wanted Person to be displayed in the color DarkCyan, and the rest black. If you click on the button once - everything is done, as I planned, if you click twice, the subsequent added text and so on are already being painted.
PS: Is there a function in C # that could highlight a specific word in richTextBoxe, or is it just the next word?