What should you do to prevent other control from receiving instructions that the Alt+D keys are pressed?

A Domain.com manager named Andy Booth has asked you to create a custom control. You want to custom control to take action when a user presses the Alt+D keys. It must be of such a nature that it allows you to prevent other control from receiving instructions that the Alt+D keys are pressed. What should you do?

A Domain.com manager named Andy Booth has asked you to create a custom control. You want to custom control to take action when a user presses the Alt+D keys. It must be of such a nature that it allows you to prevent other control from receiving instructions that the Alt+D keys are pressed. What should you do?

A.
Handle the KeyDown event.

B.
Override the OnKeyDown method.

C.
Override the OnKeyPress method.

D.
Handle the KeyPress event.

Explanation:
The OnKeyDown method specifies a KeyEventArgs instance as a parameter. The KeyEventArgs class also contains a Modifier keys that were pressed.

Incorrect Answers:
A: This will stop other controls from getting instructions that the Alt+D keys were pressed.
C: The OnKeyPress is invoked when you press a key. Overriding the OnKeyPress will not allow you to find the combination of the modifier keys that was pressed.
D: The KeyPress event is raised when a key is pressed. This will not allow you to find the combination of the modifier keys that was pressed.



Leave a Reply 0

Your email address will not be published. Required fields are marked *