首页 > 代码库 > 虚拟键盘的代码

虚拟键盘的代码

 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             else20             {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         }