更改标签事件以进入事件 [英] change the tab event to enter event

查看:74
本文介绍了更改标签事件以进入事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将选项卡按钮更改为输入按钮事件?

How to change the tab button into enter button event?

推荐答案

如果我对您的理解正确,则希望更改某些控件收到的输入. />
我可以尝试通过子类化目标Control并覆盖其OnKeyDown事件来进行尝试:
If I understand you correctly, You want to change the input that some Control receives.

I would try that by subclassing the target Control and override its OnKeyDown event:
protected override void OnKeyDown(KeyEventArgs e)
{
    if ((e.KeyCode & Keys.Tab) != Keys.None)
    // "Tab" was pressed
    {
        e.KeyCode &= ~Keys.Tab;     // Forget "Tab"
        e.KeyCode |= Keys.Enter;    // Use "Enter" instead
    }

    base.OnKeyDown(e);
}

这应该使派生类也像"Tab"也是"Enter"一样起作用.

That should make the derived class act as if "Tab" was an "Enter" as well.


这篇关于更改标签事件以进入事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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