Visual Studio Shortcutkeys

2019-07-24 11:37发布

问题:

I was working on a project, and while pressing some shortcut keys, I noticed the status bar of Visual Studio 2010:

Please try some shortcuts yourself to notice the whole behavior of VS, and then...how could I achieve that effect at the same level of performance? Thanks in advance!

P.S. I have the following code block taken from Stack Overlow, that does something like that but not the same performacnce level. My code works for CTRL + K, P.

protected override bool ProcessCmdKey( ref Message msg, Keys keyData )
{
    if (prefixSeen)
    {
        if (keyData == ( Keys.Control | Keys.P))
        {
            MessageBox.Show( "Got it!" );
            keyComb.Text = "Ready";
        }
        prefixSeen = false;
        return true;
    }
    if (keyData == ( Keys.Control | Keys.K))
    {
        prefixSeen = true;
        keyComb.Text = "CTRL + K was pressed. Waiting for a second chord of keys...";
        return true;
    }
    return base.ProcessCmdKey( ref msg, keyData );
}

But after pressing CTRL + K The label keyComb does not take the value "CTRL + K was pressed. Waiting for a second chord of keys..."

Code taken from: How to get a combination of keys in c#