c#按键Up和Down对Textbox的内容加1减1

        private void textBox_proc1value_KeyDown(object sender, KeyEventArgs e)
{
Keys key = e.KeyCode;
if (e.Control!=true)//如果没按Ctrl键
return;
TextBox textBox = sender as TextBox;
switch (key)
{
case Keys.Up:
textBox.Text = (int.Parse(textBox.Text.Trim()) + ).ToString();
break;
case Keys.Down:
textBox.Text = (int.Parse(textBox.Text.Trim()) - ).ToString();
break;
}
}
上一篇:uva 10780


下一篇:关于一些基础的Java问题的解答(七)