How can I move a control ( a image ) in the form by keyboard?
I don’t know how to do it.
C#
Thanks
How can I move a control ( a image ) in the form by
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming you use WinForm (but for WPF its not much different):
Each control has a
KeyDownevent, which is fired when a key is pressed down (and a KeyUP and KeyPress which are fired accordingly:So you can do something like the following (e.g. in the constructor or load event of the form):