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

上一篇:UIButton的resizableImageWithCapInsets使用解析


下一篇:webworkers类似windowservice在后台跑任务