日期:2014-05-17 浏览次数:21209 次
this.richTextBox1.Focus();
this.richTextBox1.SelectionStart = 0;
//加上这句将输入状态改为Insert状态
System.Windows.Forms.SendKeys.Send("{INSERT}");
private void txtContent_KeyDown(object sender, KeyEventArgs e)
{
RichTextBox txtTmp = sender as RichTextBox;
if (e.KeyCode == Keys.Enter)
{
int i = txtTmp.GetLineFromCharIndex(txtTmp.SelectionStart);
txtTmp.SelectionStart = txtTmp.GetFirstCharIndexFromLine(i) + 1;
}
}
this.richTextBox1.Focus();
//加上这句将输入状态改为Insert状态
System.Windows.Forms.SendKeys.Send("{INSERT}");
this.richTextBox1.Text = "你想添加的字符串" + this.richTextBox1.Text.Substring("你想添加的字符串".Length);
this.richTextBox1.SelectionStart = "你想添加的字符串".Length;