This is the code:
private void richTextBox1_MouseMove(object sender, MouseEventArgs e) { int positionToSearch = richTextBox1.GetCharIndexFromPosition(new Point(e.X, e.Y)); richTextBox1.SelectionStart = positionToSearch; richTextBox1.SelectionLength = 1; richTextBox1.SelectionColor = Color.Red; }
I move the mouse over the text and its painting/coloring the current char/letter in Red.
I want to keep to hold the last one char/letter before in a variable.
For example if the mouse was over a letter: B
Now B is in red now i move the mouse over a letter: D
So now D is in red now i want that i will have a variable int type like positionToSearch that will hold the position of B
Then i moved from D to Y so the variable will hold now the position of D.