C# 中 控件中只能输入数字 KeyPress 事件

来源:互联网 发布:火牛软件 编辑:程序博客网 时间:2024/06/06 00:37
 private void controls_KeyPress(object sender, KeyPressEventArgs e)
 {
        if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar))
            e.Handled = true;
 }
原创粉丝点击