首页 > 代码库 > c#按键Up和Down对Textbox的内容加1减1

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()) + 1).ToString();                   break;               case Keys.Down:                   textBox.Text = (int.Parse(textBox.Text.Trim()) - 1).ToString();                   break;           }        }

 

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