How to use combination of keyboard arrow keys
I am developing a cad software using GDI+ (c++/Cli and framework 3.5开发者_Python百科). When user wants to move a line I want to use arrow keys. Presently I am using Number Keys 4,6,8 and 3 for left right, up and down and 7,9, 1 and 3 for diagonal. How to get diagonal using Arrow keys?
Assuming you have Num Lock on, you could still use the 7, 9, 1, and 3 keys as diagonal arrows.
- The 7 is the home key
- The 9 is the page up key
- The 1 is the end key
- The 3 is the page down key
You would have to intercept those 4 keystrokes, and perform the diagonal move line function.
Try handling both keyup and keydown events instead of keypress. Accumulate the directions on keydown, move on keyup.
精彩评论