Link to home
Start Free TrialLog in
Avatar of alStatus
alStatus

asked on

This KeyDownEvent is not happening?

I dont think the event is getting focused on, so the paddle it is not moving? What is going on here?


   protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Right)
                paddlex++;
            else if (e.KeyCode == Keys.Left)
                paddlex--;
            else if (e.KeyCode == Keys.Up)
                paddley--;
            else if (e.KeyCode == Keys.Down)
                paddley++;
           
            Invalidate();
            base.OnKeyDown(e);
        }
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alStatus
alStatus

ASKER

It is on a Form. Using the onPaint.
KeyPreview() was needed to be changed. Thankyou !