首页 > 其他 > 详细

回车键当Tab键使用

时间:2014-07-14 08:08:47      阅读:354      评论:0      收藏:0      [点我收藏+]

 #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。

    •  

    •  

      箭头键。

回车键当Tab键使用,布布扣,bubuko.com

回车键当Tab键使用

原文:http://www.cnblogs.com/swtool/p/3840175.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!