菜鸟求指导 richtextbox自动填值 本帖最后由 gzm998128gzm 于 2013-02-18 17:24:36 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void richTextBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { richTextBox1.Text += "qwer"; richTextBox1.Select(richTextBox1.TextLength, 0); } } \r\n是换行 private void richTextBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { richTextBox1.AppendText("\r\naaa"); e.Handled = true; } } 我是在第一行末尾打回车的 应该aaa出现在最中间啊 出现在最下面 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) { int pos = richTextBoxCh.SelectionStart; string str = richTextBoxCh.Text; string str2 = str.Substring(0, pos) + "test" + str.Substring(pos); richTextBoxCh.Text = str2; richTextBoxCh.SelectionStart = pos ; e.Handled = true; } } 高手进来下 请用通俗点讲解下C#中装箱拆箱概念,不太理解啊! 不为分值啊,看看这是什么原因呢? 求助:打印时报RPC错误 C#怎么定义可变长数组啊,最好给下代码 我写的一个数据库操作工具,请大家用用看:) 简单问题listbox的值 请教:WinForm用户控件如何实现自定义属性?(类似于Font的方式) winform 在实时获取数据方面的 关于c#数组问题 急! C#打包的程序怎么在64的系统位上运行 vs2012创建不了基于服务的数据库
{ if (e.KeyCode == Keys.Enter)
{
richTextBox1.Text += "qwer";
richTextBox1.Select(richTextBox1.TextLength, 0); }
}
{
if (e.KeyCode == Keys.Return)
{
richTextBox1.AppendText("\r\naaa");
e.Handled = true;
}
}
{
if (e.KeyCode == Keys.Return)
{
int index = richTextBox1.GetFirstCharIndexOfCurrentLine();
int line = richTextBox1.GetLineFromCharIndex(index);
String[] lines = richTextBox1.Lines;
lines[line] = "24324234234234";
richTextBox1.Lines = lines;
}
}
private void richTextBoxCh_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Return)
{
int pos = richTextBoxCh.SelectionStart;
string str = richTextBoxCh.Text; string str2 = str.Substring(0, pos) + "test" + str.Substring(pos); richTextBoxCh.Text = str2;
richTextBoxCh.SelectionStart = pos ; e.Handled = true;
}
}