1 //虚拟键盘 2 private void TelNumber_Click(object sender, EventArgs e) 3 { 4 this.timer1.Enabled = false; 5 PictureBox pic = (PictureBox)sender; 6 if (pic.Tag.ToString().Equals("clear")) 7 { 8 //输入完毕 9 textBox1.Text = ""; 10 } 11 else if (pic.Tag.ToString().Equals("back")) 12 { 13 //后退一个字符 14 if (textBox1.Text.Length > 0) 15 { 16 textBox1.Text = textBox1.Text.Substring(0, textBox1.Text.Length - 1); 17 } 18 } 19 else 20 { 21 //输入数字 22 textBox1.Text = textBox1.Text + pic.Tag.ToString(); 23 ResetTime(); 24 this.timer1.Enabled = true; 25 } 26 textBox1.Select(textBox1.Text.Length, 0);//光标定位 27 }
虚拟键盘的代码
时间: 2024-10-10 10:51:58