"Jerome Terry" <jt****@navsim.com> wrote in message
news:eq**************@TK2MSFTNGP10.phx.gbl...
Why don't UserControl's received Key events for the arrow keys? Further,
when a user control is added to a Form, why does the form stop receiving
Key events for the arrow keys? I have tried setting IsInputKey(Keys.Left,
Keys.Right, Keys.Up, Keys.Down), but that doesn't work.
Works for me, but my control has a scrollbar, and that also picks them up :(
See:
news:bf**********@linux01.dannytuppeny.com
My code looks like:
[constructor]
this.KeyDown += new KeyEventHandler(Event_KeyDown);
[then]
public void Event_KeyDown(object sender, KeyEventArgs e)
{
// 37, 38, 39, 40, left, up, right, down
switch ((int)e.KeyCode)
{
case 37:
((Message)this.Messages[this.SelectedIndex]).Expanded = false;
break;
case 39:
((Message)this.Messages[this.SelectedIndex]).Expanded = true;
break;
case 38:
this.SelectedIndex--;
break;
case 40:
this.SelectedIndex++;
break;
}
this.Invalidate();
}