Example #1
0
        private void TX_KeySpeak_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (!"Alt".Equals(e.Modifiers.ToString()))
            {
                string keyContent = ChangeKey.KeyFilter(e, "");

                if (keyContent != "")
                {
                    TX_KeySpeak.Text = keyContent;
                }
            }
        }
Example #2
0
        //按键前事件验证
        private void TX_PreviewKey_Validate(object sender, PreviewKeyDownEventArgs e)
        {
            TextBox key = (TextBox)sender;

            if (!"Delete".Equals(e.KeyCode.ToString()) && !"Back".Equals(e.KeyCode.ToString()))
            {
                string keyContent = ChangeKey.KeyFilter(e, ((TextBox)sender).Name);

                if (keyContent != "")
                {
                    key.Text = e.KeyCode.ToString();
                }
            }
            else
            {
                key.Text = "";
            }
        }