int lineIndex = richText.GetLineFromCharIndex(richText.SelectionStart);//获得当前光标所在的行号
int lineFirstCharIndex =richText.GetFirstCharIndexFromLine(lineIndex);//此行第一个char的索引
string text = richText.Lines[lineIndex]; //拿到此行文本
text="ABC"+text;//修改此行文本
richText.SelectionStart = lineFirstCharIndex;
richText.SelectionLength = richText.Lines[lineIndex].Length;
richText.SelectedText = text;//塞回文本..
转载 非原创 TextBox控制,暂时不知道怎么搞的