日期:2014-05-20  浏览次数:20706 次

急!!光标处插入值
在C#中我有一个RichEditBox,现在想在这个RichEditBox的光标处插入值。

就是我先在RichEidtBox的一个位置吧鼠标定位了,然后点旁边的地方把一个值插入到指定的这个位置!

这是到底是什么属性或者方法!

急!!


------解决方案--------------------
richTextBox.SelectionStart
------解决方案--------------------
If I were you, I would probably implement my own RichTextBox:

class MyRichTextBox : RichTextBox
{
private int insertPosition;
public int InsetPosition
{
get{}
set{}
}
}

then handle the MOUSE BUTTON UP event to get the current mouse cusor position and set it to InsertPosition. Now you know where to insert your data.
------解决方案--------------------
richTextBox.SelectionStart
------解决方案--------------------
这个效果吗?

richTextBox1.SelectedText += "your text ";