无法检测上的keydown事件按Ctrl +快捷键,只要有一个只读的文本框,重点快捷键、文本框、重点、事件

由网友(我住北渡口)分享简介:我想我通过自己解决了这个问题,但它回来困扰我的应用程序,使这里有云:i thought i solved this problem by myself but it came back to haunt my application so here it goes: 我已经注册的形式与一对夫妇的残疾人和只读文本框下...

我想我通过自己解决了这个问题,但它回来困扰我的应用程序,使这里有云:

i thought i solved this problem by myself but it came back to haunt my application so here it goes:

我已经注册的形式与一对夫妇的残疾人和只读文本框下面的keydown事件处理程序,他们只对按键简单快捷方式:

i have the following keydown event handler registered in a form with a couple of disabled and readonly textboxes and they are only simple shortcuts for the buttons:

private void AccountViewForm_KeyDown(object sender, KeyEventArgs e)
    {
        //e.SuppressKeyPress = true;
        //e.Handled = true;
        if (Control.ModifierKeys == Keys.Control && e.KeyCode == Keys.E && !isInEditMode)
            btnEditMode_Click(sender, e);
        if (Control.ModifierKeys == Keys.Control && e.KeyCode == Keys.S && isInEditMode) btnEditMode_Click(sender, e);
        if (e.KeyCode == Keys.Escape) btnCancel_Click(sender, e);
        if (Control.ModifierKeys == Keys.Control && e.KeyCode == Keys.W) Close();
    }

的形式主要有preVIEW设置为true,但每当一个只读文本框具有焦点,并且我preSS按Ctrl + E我不能让Control.ModifierKeys == Keys.Control和e.Key code == Keys.E既如此在同一时间。什么是真正奇怪的是,按Ctrl + W的作品。任何人有任何想法,这到底是怎么回事? :(

the form has KeyPreview set to true but whenever a readonly textbox has focus and i press Ctrl + E i can't get "Control.ModifierKeys == Keys.Control" and "e.KeyCode == Keys.E" to be both true at the same time. What is really strange is that Ctrl + W works. Anyone has any idea what the hell is going on? :(

推荐答案

根据这个问题和的

阅读全文

相关推荐

最新文章