Hallo,
ich habe ein kleines Problem:
Ich möchte Text in einer RichTextBox färben - das geht auch.
Da ich aber in der TextChanged-Methode
richTextBox1.Select(..., ...);
//(...)
richTextBox1.Select(richTextbox1.Text.Length, 0);
verwende, wird der Cursor nach jeder Aktion in der RichTextBox ans Ende gesetzt.
Wie kann ich speichern/feststellen o.ä. wo der Cursor steht bzw. ihn am Ende wieder da hin setzen??
Danke
C#ler
In theory, there is no difference between theory and practice. But, in practice, there is.
The nice thing about the Java API is that if you don't like it, just wait two minutes — it will change. Doug Lyon
Hallo,
du kannst die Position mit der Eigenschaft SelectionStart bestimmen und verändern.
fz
"We better hurry up and start coding, there are going to be a lot of bugs to fix."
Danke, klappt perfekt!
int CursorIndex = richTextBox1.SelectionStart;
//(...)
richtTextBox1.SelectionStart = CursorIndex;
Gruß,
C#ler
In theory, there is no difference between theory and practice. But, in practice, there is.
The nice thing about the Java API is that if you don't like it, just wait two minutes — it will change. Doug Lyon