菜鸟求指导 richtextbox自动填值
本帖最后由 gzm998128gzm 于 2013-02-18 17:24:36 编辑
原先richtextbox里面有值了,现在我在某一行大哥回车键 ,在新出来的那行自动填值(什么值无所谓)
------解决方案-------------------- private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
richTextBox1.Text += "qwer";
richTextBox1.Select(richTextBox1.TextLength, 0);
}
}
------解决方案--------------------用AppendText
------解决方案--------------------\r\n是换行
private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Return)
{
richTextBox1.AppendText("\r\naaa");
e.Handled = true;
}
}
------解决方案-------------------- private void richTextBox1_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Return)
{
int index = richTextBox1.GetFirstCharIndexOfCurrentLine();
int line = richTextBox1.GetLineFromCharIndex(index);
String[] lines = richTextBox1.Lines;
lines[line] = "24324234234234";
richTextBox1.Lines = lines;
}
}
------解决方案--------------------光标你可以Set的啊
private void richTextBoxCh_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Return)