コード例 #1
0
        private void KeyboardKeys(object sender, KeyEventArgs graph)
        {
            switch (graph.KeyCode)
            {
            case Keys.Up:

                if (!Drawings.Intersection())
                {
                    Drawings.Reset();
                    Drawings.shape.Rotate();
                    Drawings.Share();
                    Invalidate();
                }
                break;

            case Keys.Space:
                timer1.Interval = 10;
                break;

            case Keys.Right:
                if (!Drawings.Collide2(1))
                {
                    Drawings.Reset();
                    Drawings.shape.Right();
                    Drawings.Share();
                    Invalidate();
                }
                break;

            case Keys.Left:
                if (!Drawings.Collide2(-1))
                {
                    Drawings.Reset();
                    Drawings.shape.Left();
                    Drawings.Share();
                    Invalidate();
                }
                break;
            }
        }