我有以下代码:
public void tbSpeed_KeyDown(object sender,KeyRoutedEventArgs e) { e.Handled = !((e.Key >= 48 && e.Key <= 57) || (e.Key >= 96 && e.Key <= 105) || (e.Key == 109) || (e.Key == 189)); }
解决方法
@H_404_9@ 使用 GetKeyState.var state = CoreWindow.GetForCurrentThread().GetKeyState(VirtualKey.Shift); return (state & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;
注意:对于Alt,您将使用VirtualKey.Menu.