Hi Roland,
You cannot check for multiple keypresses with a single operation. In the
Keys enumeration, letter keys do not have "Flag" values that can be OR'd
together, such as Keys.N | Keys.P. In this case, Keys.N = 78 and Keys.P =
80. Only the modifier keys such as Keys.Shift can be OR'd with letter keys,
such as Keys.Shift | Keys.N.
Instead, to detect a complex key sequence, you need to save the state of the
keypress then check that state on the next keypress. For example:
private Keys m_PreviousKey;
private void MdiParentForm_KeyDown(object sender, KeyEventArgs e)
{
switch(e.KeyData)
{
case Keys.Control|Keys.N:
Console.WriteLine( "First key" );
break;
case Keys.P:
if (this.m_PreviousKey == Keys.Control|Keys.N)
Console.WriteLine( "GOT IT!" );
break;
}
this.m_PreviousKey = e.KeyData;
}
> Hello,
>
[quoted text clipped - 11 lines]
> }
> }

Signature
Timm Martin
Mini-Tools
.NET Components and Windows Software
http://www.mini-tools.com
Roland Müller - 27 Jul 2006 14:56 GMT
Thanks, that is easy and logical.
Mini-Tools Timm schrieb:
> Hi Roland,
>
[quoted text clipped - 38 lines]
>> }
>> }