<tfoot id='KtOfF'></tfoot>

  • <legend id='KtOfF'><style id='KtOfF'><dir id='KtOfF'><q id='KtOfF'></q></dir></style></legend>

    1. <i id='KtOfF'><tr id='KtOfF'><dt id='KtOfF'><q id='KtOfF'><span id='KtOfF'><b id='KtOfF'><form id='KtOfF'><ins id='KtOfF'></ins><ul id='KtOfF'></ul><sub id='KtOfF'></sub></form><legend id='KtOfF'></legend><bdo id='KtOfF'><pre id='KtOfF'><center id='KtOfF'></center></pre></bdo></b><th id='KtOfF'></th></span></q></dt></tr></i><div id='KtOfF'><tfoot id='KtOfF'></tfoot><dl id='KtOfF'><fieldset id='KtOfF'></fieldset></dl></div>

        • <bdo id='KtOfF'></bdo><ul id='KtOfF'></ul>

        <small id='KtOfF'></small><noframes id='KtOfF'>

        如何不允许一次按键收到多个按键?

        时间:2023-07-26
        <tfoot id='k89At'></tfoot>
        1. <i id='k89At'><tr id='k89At'><dt id='k89At'><q id='k89At'><span id='k89At'><b id='k89At'><form id='k89At'><ins id='k89At'></ins><ul id='k89At'></ul><sub id='k89At'></sub></form><legend id='k89At'></legend><bdo id='k89At'><pre id='k89At'><center id='k89At'></center></pre></bdo></b><th id='k89At'></th></span></q></dt></tr></i><div id='k89At'><tfoot id='k89At'></tfoot><dl id='k89At'><fieldset id='k89At'></fieldset></dl></div>

            <bdo id='k89At'></bdo><ul id='k89At'></ul>
          • <small id='k89At'></small><noframes id='k89At'>

              <tbody id='k89At'></tbody>

                • <legend id='k89At'><style id='k89At'><dir id='k89At'><q id='k89At'></q></dir></style></legend>

                  本文介绍了如何不允许一次按键收到多个按键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当我们按下一个键并持续按下它时,keypress 和 keydown 事件会不断触发.有没有办法让这些只在一个完整的循环后触发,例如按键然后按键.

                  when we press a key and keep pressing it the keypress and keydown event continuously fires. Is there a way to let these fire only after a complete cycle ,eg keydown and then key up.

                  我希望用户不能连续按键,而是希望用户必须按下然后释放键盘才能输入字符!

                  I would like the user not to be able press the key continuously rather would like the user have to press then release the key board to type a character !

                  这样就不会发生以下情况,例如:当用户按下 'p' 1 秒时,pppppppppppppppppppppppp.

                  so that following case do not occur eg : pppppppppppppppppppppppp when user presses 'p' for 1 sec.

                  推荐答案

                  声明一个boolean isKeyDown,在KeyDown事件中,设置boolean为true.在 KeyUp 事件中,将布尔值设置为 false.

                  Declare a boolean isKeyDown, in theKeyDown Event, set the boolean to true. In the KeyUp event, set the boolean to false.

                  这是示例代码

                  bool isKeyDown=false;
                  public void control_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
                  {
                      if(isKeyDown)
                        return;
                      isKeyDown=true;
                      // do what you want to do
                  }
                  
                  public void control1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
                  {
                     isKeyDown=false;
                     // do you key up event, if any. 
                  }
                  

                  这篇关于如何不允许一次按键收到多个按键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:WPF FocusNavigationDirection、MoveFocus 和箭头键 下一篇:通过 ProcessCmdKey 捕获键序列

                  相关文章

                  <i id='YZX9W'><tr id='YZX9W'><dt id='YZX9W'><q id='YZX9W'><span id='YZX9W'><b id='YZX9W'><form id='YZX9W'><ins id='YZX9W'></ins><ul id='YZX9W'></ul><sub id='YZX9W'></sub></form><legend id='YZX9W'></legend><bdo id='YZX9W'><pre id='YZX9W'><center id='YZX9W'></center></pre></bdo></b><th id='YZX9W'></th></span></q></dt></tr></i><div id='YZX9W'><tfoot id='YZX9W'></tfoot><dl id='YZX9W'><fieldset id='YZX9W'></fieldset></dl></div>

                      <bdo id='YZX9W'></bdo><ul id='YZX9W'></ul>
                  1. <legend id='YZX9W'><style id='YZX9W'><dir id='YZX9W'><q id='YZX9W'></q></dir></style></legend>
                  2. <small id='YZX9W'></small><noframes id='YZX9W'>

                    1. <tfoot id='YZX9W'></tfoot>