Nope, it definitely happens.
If you make an owner-drawn user control (with no controls on it), and
put it on a form, with other controls (say a button), then using the
arrow keys will move focus to the other control.
However, I have found the solution after Googling for hours, it is to
override the IsInputKey method of the UserControl like so:
protected override bool IsInputKey(Keys key)
{
switch(key)
{
case Keys.Up:
case Keys.Down:
case Keys.Right:
case Keys.Left:
return true;
}
return base.IsInputKey(key);
}
Which I haven't tried yet because I'm on linux at the moment (and I
don't have mono), but it looks feasible.
Vincent.
chanmm wrote:
Maybe you want to check again because when I move my arrow keys the focus
won't lost inside my control.
chanmm
"Vincent" <mc************@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hi,
I have a user control that needs to trap the arrow keys to move items
around internally. However, using the arrow keys will move the focus to
another control on the form hosting the user control.
How do I stop this?
Vincent.