如何检测ToolStripTextBox中的Alt +左​​键

时间:2011-09-27 23:34:55

标签: c# .net winforms

在C# - WinForms中,如何在ToolStripTextBox中按下Alt +左​​键时检测它?

1 个答案:

答案 0 :(得分:4)

    protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
        if (this.ActiveControl == toolStripTextBox1.Control && keyData == (Keys.Alt | Keys.Left)) {
            MessageBox.Show("it's special");
            return true;
        }
        return base.ProcessCmdKey(ref msg, keyData);
    }