コード例 #1
0
 private void Tetris_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Left || e.KeyCode == Keys.A)
     {
         e.SuppressKeyPress = true;
         Left_Arrow?.Invoke();
         panel_field.Invalidate();
     }
     else if (e.KeyCode == Keys.Right || e.KeyCode == Keys.D)
     {
         e.SuppressKeyPress = true;
         Right_Arrow?.Invoke();
         panel_field.Invalidate();
     }
 }
コード例 #2
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Left)
            {
                Left_Arrow?.Invoke();

                panel1.Invalidate();
            }
            else if (e.KeyCode == Keys.Right)
            {
                Right_Arrow?.Invoke();

                panel1.Invalidate();
            }
            else if (e.KeyCode == Keys.Down)
            {
                timer1.Interval = 100;
            }
        }
コード例 #3
0
        private void GameBoy_key_down(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Left) // When left arrow is pressed
            {
                MessageBox.Show("działa");
                Left_Arrow?.Invoke(); // Invokean event
                screen.Invalidate();  // Refreshing the screen synchronously
            }

            else if (e.KeyCode == Keys.Right) // When right arrow is pressed
            {
                Right_Arrow?.Invoke();        // Invokean event
                screen.Invalidate();          // Refreshing the screen synchronously
            }

            else if (e.KeyCode == Keys.Down)        // When down arrow is pressed
            {
                timer1.Interval = arrow_down_speed; // speed up the game
            }
        }
コード例 #4
0
 private void GameBoy_button_left(object sender, MouseEventArgs e)
 {
     Left_Arrow?.Invoke(); // Invokean event
     screen.Invalidate();  // Refreshing the screen synchronously
 }