VB 2010中的多键热键 [英] Multi Key Hotkeys in VB 2010

查看:100
本文介绍了VB 2010中的多键热键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VB 2010中编写了一个简单的WAV播放器-一个没有菜单的Windows Form应用程序.我正在尝试创建一个热键,如CTRL-D,它将使文本框可见.在框中输入正确的密码将展开表格并显示一些管理功能.我在使用多个按键创建热键时遇到问题.

I've written a simple WAV player in VB 2010 - a Windows Form App with no menus. I'm trying to create a hotkey, like CTRL-D that would make a text box visible. Typing the correct password in the box will expand the form and show some Administrative functions. I'm having issues creating the hotkey with more than one key.

我有以下代码,但是它不起作用.我确实将KeyPreview设置为True.

I've got the following code, but it does not work. I do have KeyPreview set to True.

Private Sub _KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    If e.KeyCode = Keys.Control And e.KeyCode = Keys.D Then
        txtPWD.Visible = True

我也尝试过

If e.Keycode = Keys.ControlKey & e.KeyCode = Keys.D

和许多其他变体,包括更改为ALT和SHIFT,但似乎无济于事.如果我删除其中一个键,它就可以正常工作.我在哪里弄错了?

and many other variations including changing to ALT and SHIFT but nothing seems to work. If I remove one of the Keys, it works just fine. Where am I getting this wrong?

推荐答案

检查Modifierkey:

Check for Modifierkeys:

http://msdn.microsoft. com/en-us/library/system.windows.forms.control.modifierkeys.aspx

这篇关于VB 2010中的多键热键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆