• 回车键当Tab键使用


     #region 回车键当Tab键使用
            private void enter_KeyPress(object sender, KeyPressEventArgs e)
            {
                foreach (Control c in this.Controls)
                {
                    c.KeyPress += new System.Windows.Forms.KeyPressEventHandler(sendEnter);
                }
            }
            private void sendEnter(object sender, KeyPressEventArgs e)
            {
                if (e.KeyChar == (char)Keys.Enter)
                {
                    //使按键生效
                    e.Handled = true;
                    //发送按键指令
                    SendKeys.Send("{Tab}");
                }
            }
            #endregion

    使用 KeyChar 属性在运行时对击键取样,在特定运行时环境下修改击键。 例如,您可以使用 KeyChar 在用户输入邮政编码时禁用非数字按键,将数据输入字段中所有的字母按键都改为大写,或监视键盘或其他按键输入设备的特定组合键。

    您可以获取或设置以下键:

    • a-z,A-Z。

    • Ctrl。

    • 标点符号。

    • 键盘顶部和数字键盘上的数字键。

    • Enter。

    您不能获取或设置以下键:

      • Tab 键。

      • Insert 和 Delete。

      • Home。

      • End。

      • Page Up 和 Page Down。

      • F1-F2。

      • Alt。

      • 箭头键。

  • 相关阅读:
    python的sorted相关
    dict两种遍历方法
    python 深拷贝和浅拷贝浅析
    牛人总结python中string模块各属性以及函数的用法,果断转了,好东西
    Python二分查找
    堆和栈区别
    一次完整的HTTP事务是怎样一个过程?(转)
    ------shell学习
    BZOJ1025 [SCOI2009]游戏
    BZOJ1024 [SCOI2009]生日快乐
  • 原文地址:https://www.cnblogs.com/swtool/p/3840175.html
Copyright © 2020-2023  润新知