I want to change the color of the entire line, regardless of whether the text is there is or no. Here is some explaining image:
.
I found some solution here, but I hope that there is a simpler solution.
No, you first have to select the line, then you have to set the color:
public void MarkSingleLine()
{
int firstCharOfLineIndex = myRichTextBox.GetFirstCharIndexOfCurrentLine();
int currentLine = richTextBox1.GetLineFromCharIndex(firstCharOfLineIndex);
this.myRichTextBox.Select(firstCharOfLineIndex, currentLine);
this.myRichTextBox.SelectionBackColor = Color.Aqua;
this.myRichTextBox.Select(0, 0);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With