c# 捕获 Ctrl+PageUp 按键
我在 WinForms 应用程序的 ListView 控件中捕获 Ctrl+PageUp 击键时遇到问题。
我正在使用此代码来捕获击键 -
private void ListViewEx_KeyDown(object sender, KeyEventArgs e)
{
...
if(e.Control){
if((e.KeyCode ^ Keys.Left) == 0)
MessageBox.Show("Left"); //shows messagebox
else if((e.KeyCode ^ Keys.PageUp) == 0)
MessageBox.Show("PageUp"); //does not
...
}
我是否需要深入 WndProc 来处理此键?谢谢。
编辑:我发现这可行,问题在于在 ListControl 到达这些键之前封闭 TabControl 处理这些键。
I am having trouble capturing Ctrl+PageUp keystroke in a ListView control in WinForms application.
I am using this code to capture keystrokes -
private void ListViewEx_KeyDown(object sender, KeyEventArgs e)
{
...
if(e.Control){
if((e.KeyCode ^ Keys.Left) == 0)
MessageBox.Show("Left"); //shows messagebox
else if((e.KeyCode ^ Keys.PageUp) == 0)
MessageBox.Show("PageUp"); //does not
...
}
Do I need to dive into WndProc to process this key? Thanks.
Edit: I've found out that this works, the problem was in enclosing TabControl handling these keys before ListControl got to them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不需要 WndProc:
No need for WndProc:
e.KeyData 参数包括修饰键。让它看起来像这样:
The e.KeyData argument includes the modifier keys. Make it look like this:
检查
check for