检测多次 PageUp/PageDown 按键

Detecting multiple PageUp/PageDown key presses

我在 WinForms 中有一个 NumericUpDown 控件。 Up/Down 箭头键 increase/decrease 值加 1。我想映射 PageUp/PageDown 键以获得更大的增量。

Control.KeyPress 事件不会被 PageUp/PageDown 键触发,如果我使用 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;
    }

你能在事件处理程序中提供你的代码吗? /对不起,我知道我不应该在回答中要求澄清,但我不能写评论。/