TextBox文字前加行号 TextBox文字前加行号 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 就是我在一个TEXTBOX中输入了很的行的文字,我想的输入的换行的时候,自动在每一行前加一个行号,如:第一行就是1 dfsdfdsf2 df;ldkfdsl;f3 dfsdf 看下http://www.codeproject.com/cs/miscctrl/numberedtextbox.asp private int ii = 1;private bool ff = false;private void textBox5_Enter(object sender, System.EventArgs e){ this.textBox5.Text += "1 >>>"; this.textBox5.Select(this.textBox5.Text.Length,0);}private void textBox5_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e){ if(e.KeyChar == (Char)Keys.Enter) { ff = true; } else { ff = false; }}private void textBox5_TextChanged(object sender, System.EventArgs e){ if(ff) { ff = false; this.textBox5.Text += (++ii).ToString() + " >>>"; this.textBox5.Select(this.textBox5.Text.Length,0); }}-------------------------------------------------------------------没有考虑删除等问题。 楼主能把代码发给我吗?我邮箱是[email protected]谢谢了,急用 动态改变 ListView 上提示信息,如何弄? 网上书店中主页上显示的编辑推荐图书是根据什么条件查找出来的 C# 读取TXT文件的问题。 正则表达式匹配问题 二进制文件的读写 C# 如何替换byte[]中的全部\0为"" xmlDoc为什么没有保存修改的内容 使用udp发送汉字的时候是乱码,怎么解决! 请问里c#有什么现成的方法可以修改mac地址吗?(windows里) 怎么将一个字符串存到一个EXCEL表里的第一行一列中,而且以后的字符串是追加的方式写入 请问一个关于数据类型判断的问题 错在何处~~?? 真的找不出来
1 dfsdfdsf
2 df;ldkfdsl;f
3 dfsdf
http://www.codeproject.com/cs/miscctrl/numberedtextbox.asp
private bool ff = false;private void textBox5_Enter(object sender, System.EventArgs e)
{
this.textBox5.Text += "1 >>>";
this.textBox5.Select(this.textBox5.Text.Length,0);
}private void textBox5_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar == (Char)Keys.Enter)
{
ff = true;
}
else
{
ff = false;
}
}private void textBox5_TextChanged(object sender, System.EventArgs e)
{
if(ff)
{
ff = false;
this.textBox5.Text += (++ii).ToString() + " >>>";
this.textBox5.Select(this.textBox5.Text.Length,0);
}
}
-------------------------------------------------------------------
没有考虑删除等问题。