zoukankan      html  css  js  c++  java
  • winform 通过左右键,或enter键做类似Tab键的功能

    有时候我们需要使用enter,或arrow key来跳到下一个控件,可是我做怎么样做才实现与Tab一样的校果呢. 很简单,我们只要把窗体的keypreview属性设为true.然后在keyup或所有的keyevent事件里.写上如下的代码:

             private void Form1_KeyUp(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter||e.KeyCode==Keys.Right)
                {
                    if (ActiveControl != null)
                    {
                        this.SelectNextControl(this.ActiveControl, true, true, true, true);                    
                        //this.SelectNextControl(this.ActiveControl, true, false, false, true);
                        //this.ActiveControl.SelectNextControl(this.ActiveControl, true, false, false, true);
                    }
                }      
            }

  • 相关阅读:
    my first android test
    VVVVVVVVVV
    my first android test
    my first android test
    my first android test
    ini文件
    ZZZZ
    Standard Exception Classes in Python 1.5
    Python Module of the Week Python Module of the Week
    my first android test
  • 原文地址:https://www.cnblogs.com/Bany/p/1755542.html
Copyright © 2011-2022 走看看