当前位置: 代码迷 >> .NET Framework >> 急光标处插入值解决办法
  详细解决方案

急光标处插入值解决办法

热度:107   发布时间:2016-05-02 00:53:43.0
急!!光标处插入值
在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 ";
  相关解决方案