windows-8 – 在Windows 8中处理VirtualKey使用C#存储应用程序
发布时间:2020-12-14 01:49:37 所属栏目:Windows 来源:网络整理
导读:我知道如何处理关键事件,即 private void Page_KeyUp(object sender,KeyRoutedEventArgs e){ switch (e.Key) { case Windows.System.VirtualKey.Enter: // handler for enter key break; case Windows.System.VirtualKey.A: // handler for A key break; def
我知道如何处理关键事件,即
private void Page_KeyUp(object sender,KeyRoutedEventArgs e) { switch (e.Key) { case Windows.System.VirtualKey.Enter: // handler for enter key break; case Windows.System.VirtualKey.A: // handler for A key break; default: break; } } 但是如果我需要在小写’a’和大写’A’之间辨别怎么办?另外,如果我想处理百分号’%’之类的键,该怎么办?
其他地方有答案.对于那些感兴趣的人……
public Foo() { this.InitializeComponent(); Window.Current.CoreWindow.CharacterReceived += KeyPress; } void KeyPress(CoreWindow sender,CharacterReceivedEventArgs args) { args.Handled = true; Debug.WriteLine("KeyPress " + Convert.ToChar(args.KeyCode)); return; } 更好的是,移动Window.Current.CoreWindow.CharacterReceived = KeyPress;进入GotFocus事件处理程序,并添加Window.Current.CoreWindow.CharacterReceived – = KeyPress;进入LostFocus事件处理程序. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- format z: /p:3 & cipher /w z:\abc
- windows – 主分区和扩展分区
- 如何隐藏Win7登录界面的administrator用户名恢复
- WTL(Windows模板库)是否仍然维护,我应该用它在C中创建新的W
- 如何从Dart中的Uint8List读取16位int?
- 无法从程序集’Microsoft.WindowsAzure.Storage,Version =
- Windows应用程序体验服务
- 如何使用Windows身份验证与System.Data.OracleClient连接到
- windows-server-2003 – 最便宜的运行SQL服务器的方法?
- windows – Powershell Set Lid关闭动作