Пример #1
0
        void GameFieldPictureBoxPaint(object sender, PaintEventArgs e)
        {
            GF.Paint(e.Graphics);

            if (Game.Paused)
            {
                Rectangle img = new Rectangle((GameFieldPictureBox.Width - PausedImage.Width) / 2,
                                              (GameFieldPictureBox.Height - PausedImage.Height) / 2,
                                              PausedImage.Width, PausedImage.Height);
                e.Graphics.DrawImage(PausedImage, img);
                return;
            }
            if (Game.GameOver)
            {
                Rectangle img = new Rectangle((GameFieldPictureBox.Width - GameOverImage.Width) / 2,
                                              (GameFieldPictureBox.Height - GameOverImage.Height) / 2,
                                              GameOverImage.Width, GameOverImage.Height);
                e.Graphics.DrawImage(GameOverImage, img);
            }
        }
Пример #2
0
        private void PicGameField_Paint(object sender, PaintEventArgs e)
        {
            gameField.Paint(e.Graphics);

            if (tetrisGame.Paused)
            {
                Rectangle img = new Rectangle((picGameField.Width - imgPaused.Width) / 2,
                                              (picGameField.Height - imgPaused.Height) / 2,
                                              imgPaused.Width, imgPaused.Height);
                e.Graphics.DrawImage(imgPaused, img);
                return;
            }
            if (tetrisGame.GameOver)
            {
                Rectangle img = new Rectangle((picGameField.Width - imgGameOver.Width) / 2,
                                              (picGameField.Height - imgGameOver.Height) / 2,
                                              imgGameOver.Width, imgGameOver.Height);
                e.Graphics.DrawImage(imgGameOver, img);
            }
        }