RichTextBox CaretPosition 物理位置 [英] RichTextBox CaretPosition physical location
问题描述
我正在使用 RichTextBox 类进行一些自动文本格式设置.mz 的问题是,如何让 RichTextBox 在插入符号后立即放置一些字符串.当我使用 RichTextBox.CaretPosition.InsertTextInRun("some string") 时,文本被插入到当前逻辑块之后,但我需要在插入符号之后立即插入,在 Run 块的中间.我希望它很清楚,非常感谢.
I'm using a RichTextBox class to make some automatic text formatting. And mz question is, how do I get the RichTextBox to put some string immediately after the caret. When I use RichTextBox.CaretPosition.InsertTextInRun("some string") the text is inserted after the current logical block, but I need to be insterted immediately after the caret, in the middle of a Run block. I hope it's clear, thx very much.
推荐答案
我想你现在可能已经解决了这个问题,但我还是会回答.
I think you might have solved this issue by now, but I'll answer anyway.
这是我用于解决类似问题的方法:
This is what I used for a similar problem:
public string SelectionText
{
get { return this.Selection.Text; }
set { this.Selection.Text = value; }
}
这篇关于RichTextBox CaretPosition 物理位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!