Keyboard event propagation in winforms

后端 未结 2 1404
北海茫月
北海茫月 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:05

    You can use MouseUp, MouseEnter, MouseDown or MouseHover ....

    Link about Mouse Down : http://msdn.microsoft.com/en-us/library/system.windows.forms.control.mousedown.aspx

    Link : http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.aspx

    0 讨论(0)
  • 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

    0 讨论(0)
提交回复
热议问题