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;
            }
        }
Beispiel #3
0
        private void txtInputUFloat_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\b')//'b'为退格键,一般退格键是一定会有效的,认为是不变的部分
            {
                return;
            }

            InputLimit inputLimit = new TextBoxInputLimit(sender);

            inputLimit = new NumberType(inputLimit);

            if (!inputLimit.InputCheck(e.KeyChar))
            {
                e.Handled = true;
                return;
            }
        }