有没有办法,我可以使用,每当我需要访问控制,Shift键,Alt键按钮是否造成了一些全球性的结构?例如在的MouseDown
的事件的TreeView
。
Is there some global constructs that I can use whenever I need to access whether the Control, Shift, Alt buttons are down? For instance inside MouseDown
event of a TreeView
.
如果这样怎么办?
使用类Keyboard.使用Keyboard.IsKeyDown您可以检查是否控制,Shift键,Alt键是失望吧。
Use class Keyboard
. Using Keyboard.IsKeyDown
you can check if Control, Shift, Alt is down now.
有关转变:
if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
{ /* Your code */ }
有关控制:
if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
{ /* Your code */ }
有关ALT:
if (Keyboard.IsKeyDown(Key.LeftAlt) || Keyboard.IsKeyDown(Key.RightAlt))
{ /* Your code */ }