private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            //文本框只能输入数字
            if (!Char.IsDigit(e.KeyChar))
            {
                e.Handled = true;
            }
        }

含义:当输入的字符不是数字。e.Handled 设置为True.表示此事件已经处理完成。消息到此就被丢掉了。

相关文章:

  • 2022-12-23
  • 2021-08-01
  • 2021-08-01
  • 2021-09-19
  • 2021-08-01
  • 2021-11-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
相关资源
相似解决方案