Hi,
I have a control with KeyDown and KeyUp events as shown below. The problem I am having is that 'x' is TRUE in KeyDown but always FALSE in KeyUp. I am trying to detect the Alt key (as you may have guessed).
Is there a gottcha that I don't know. I mean, when I press Alt it detects it ok but on keyup it's false.
Any suggestions/ideas
Thanks
private void MyControl_KeyDown(object sender, KeyEventArgs e)
{
bool x;
x = ((int) (e.KeyData & Keys.Alt) != 0);
x = (e.KeyData & Keys.Alt) == Keys.Alt;
x = e.Alt;
}
private void MyControl_KeyUp(object sender, KeyEventArgs e)
{
bool x;
x = ((int) (e.KeyData & Keys.Alt) != 0);
x = (e.KeyData & Keys.Alt) == Keys.Alt;
x = e.Alt;
}