コード例 #1
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Left)
            {
                //0 for left
                Plane.changeState(0);
                this.BackgroundImage = Plane.getImage();
                Invalidate();
            }
            else if (e.KeyCode == Keys.Right)
            {
                Plane.changeState(1);
                this.BackgroundImage = Plane.getImage();
                Invalidate();
            }

            else if (e.KeyCode == Keys.P)
            {
                pause();
            }
        }
コード例 #2
0
        private void startNew()
        {
            FileName = null;
            BackgroundImageLayout = ImageLayout.Stretch;
            BallController        = new BallController(0, this.Width, this.Height);
            Plane = new Plane(BallController);
            this.BackgroundImage = Plane.getImage();
            this.DoubleBuffered  = true;
            Paused = false;

            this.MouseClick += new MouseEventHandler(this.mouse_click);
        }