Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 检测多个PageUp/PageDown键按下_C#_.net_Winforms_Keypress - Fatal编程技术网

C# 检测多个PageUp/PageDown键按下

C# 检测多个PageUp/PageDown键按下,c#,.net,winforms,keypress,C#,.net,Winforms,Keypress,我在WinForms中有一个NumericUpDown控件。上/下箭头键将值增加/减少1。我想映射PageUp/PageDown键以获得更大的增量 使用PageUp/PageDown键不会触发Control.KeyPress事件,如果使用Control.KeyUp/Control.KeyDown事件,即使用户按住键一段时间,组合也只会触发一次 在长时间的按键过程中,我如何捕获多个PageUp/PageDown按键?说起来很奇怪,但我无法重现这个问题。我有一个新的winform实例,numeric

我在WinForms中有一个NumericUpDown控件。上/下箭头键将值增加/减少1。我想映射PageUp/PageDown键以获得更大的增量

使用PageUp/PageDown键不会触发
Control.KeyPress
事件,如果使用
Control.KeyUp/Control.KeyDown
事件,即使用户按住键一段时间,组合也只会触发一次


在长时间的按键过程中,我如何捕获多个PageUp/PageDown按键?

说起来很奇怪,但我无法重现这个问题。我有一个新的winform实例,numericUpDown控件,具有默认属性值和KeyDown事件处理程序,可与长时间按键完美配合:

private void numericUpDown1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.PageDown)
            numericUpDown1.Value -= 10;
        else if (e.KeyCode == Keys.PageUp)
            numericUpDown1.Value += 10;
    }
能否在事件处理程序中提供代码?
/对不起,我知道我不应该在回答中要求澄清,但我不能写评论。

啊,我的实现只有在KeyDown和keydup都匹配同一个键的情况下才操纵值。你的例子确实有效。