开发者

How to use combination of keyboard arrow keys

开发者 https://www.devze.com 2023-02-10 10:44 出处:网络
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 r

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号