快速按下alt + tab键,触发c#中的下一个制表位 [英] Pressing alt+tab key quickly, triggers the next tab stop in c#

查看:147
本文介绍了快速按下alt + tab键,触发c#中的下一个制表位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在具有以下代码的表单中覆盖了ProcessCmdKey:

if(keyData == Keys.Tab)

{

返回true ;

}

返回base.ProcessCmdKey(ref msg,keyData);



在listview_KeyUp中:

if(e.KeyCode == Keys.Tab &&!e.Alt)

{

treeview.Focus();

}



在treeview_KeyUp:

if(e.KeyCode == Keys.Tab &&!e.Alt)

{

listview.Focus();

}



现在,重点是在列表视图上,

当应用程序处于非活动状态/最小化时,

和alt + tab键快速按下,

应用程序现在处于活动状态但是重点

现在是树视图。



看来当我快速按下alt + tab时,我最后发布了标签

并且基于代码它应该关注treeview。

但是我不想要这种行为。



我试过了程序与Windows资源管理器。

它没有切换到下一个tabstop

我想要这种行为。



我如何像Windows资源管理器一样编程?

I have overridden ProcessCmdKey in a form having this code:
if (keyData == Keys.Tab)
{
return true;
}
return base.ProcessCmdKey(ref msg, keyData);

In listview_KeyUp:
if (e.KeyCode == Keys.Tab && !e.Alt)
{
treeview.Focus();
}

In treeview_KeyUp:
if (e.KeyCode == Keys.Tab && !e.Alt)
{
listview.Focus();
}

Now, the focus is on listview,
when the application is inactive/minimized,
and alt+tab key is pressed quickly,
the application is now active but the focus
is now at treeview.

It seems when I pressed alt+tab quickly, I released tab last
and based on the code it should focus treeview.
But I don''t want this behavior.

I tried the procedure with windows explorer.
It didn''t switch to the next tabstop
I want this behavior.

How do I program it like windows explorer?

推荐答案

你不应该想要它,这是一个虚假的要求,实际上是一个UI犯罪。用户期望操作的一致性是OS UI常见的,而不是任何特定的应用程序。



你不能打电话给你建议的修复。现有的行为非常好,破坏的行为不能称为修复。



-SA
You should not "want" it, this is a false requirement, in fact, one of UI crimes. The user expect consistency in behavior which is common to the OS UI, not to any particular application.

You cannot call what you suggest a fix. Existing behavior is quite good, and a broken behavior cannot be called a "fix".

—SA

这篇关于快速按下alt + tab键,触发c#中的下一个制表位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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