Keyboard event propagation in winforms

后端 未结 2 1405
北海茫月
北海茫月 2021-01-18 10:20

I have a user control. Within the user control, there is a PictureBox that uses up the entire screen estate (Dock.Fill). I would like to catch keyboard events (e.g., Ctrl-V

2条回答
  •  醉话见心
    2021-01-18 11:24

    You can receive the event in the form. See Form.KeyPreview.

    When this property is set to true, the form will receive all KeyPress, KeyDown, and KeyUp events. After the form's event handlers have completed processing the keystroke, the keystroke is then assigned to the control with focus

提交回复
热议问题