如何更新光标位置? [英] How can i update cursor position?
本文介绍了如何更新光标位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能的重复:
在 RichTextBox 中设置光标
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
string text = richTextBox1.Text.ToString();
text = text.Replace("a", "අ");
text = text.Replace("අඅ", "ආ");
richTextBox1.Text = text.ToString();
}
这是我的代码.在获得结果后,光标位置出现在字母前面,那么我如何在字母后更新光标位置?请帮忙........
this is my code. in here after getting result cursor position is come in-front of the letter so how i update cursor position after the letter? please help........
推荐答案
您可以将 SelectionStart 值设置为大于文本长度的数字.这将自动将光标放在最后一个字符之后.例如this.rechTextBox1.SelectionStart = int.MaxValue;
You can set the SelectionStart value to a number larger than the length of your text. This will automatically place the cursor after the last character. e.g. this.rechTextBox1.SelectionStart = int.MaxValue;
这篇关于如何更新光标位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文