Beispiel #1
0
        private void txtInputUFloat_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\b')
            {
                return;                    //'b'为退格键
            }
            InputLimit inputLimit = new TextBoxInputLimit(sender);

            inputLimit = new NumberType(inputLimit);
            inputLimit = new PositiveType(inputLimit);

            if (!inputLimit.InputCheck(e.KeyChar))
            {
                e.Handled = true;
            }
        }
        private void tboxPositiveNum_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\b')
            {
                return;
            }

            TextBox    tbox       = sender as TextBox;
            InputLimit inputLimit = new TextBoxInputLimit(tbox);

            inputLimit = new NumberType(inputLimit);
            inputLimit = new PositiveType(inputLimit);
            if (!inputLimit.InputCheck(e.KeyChar))
            {
                e.Handled = true;
            }
        }