给你个基本原理的代码void Button1Click(object sender, EventArgs e) { string strNew = this.textBox1.Text.Substring(0,this.textBox1.Text.Length-1); this.textBox1.Text = strNew; this.textBox1.SelectionStart = this.textBox1.Text.Length; this.textBox1.Focus(); }主要就是设置SelectionStart 这个属性和 让textbox获得焦点
假设textbox 的 id 为 TextBox1 Main函数中写 string strTest=this.TextBox1.Text;strTest=StrTest.substring(0,strTest.length-1);this.TextBox1.Text=strTest; this.TextBox1.focus();