コード例 #1
0
        public void InitializeComponent()
        {
            BackColor       = Color.FromArgb(39, 196, 0);
            MinimumSize     = new Size(420, 720);
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Width           = 360;
            Height          = 400;

            textBox = new PictureBox
            {
                Image    = new Bitmap(@".\Images\Level1Passed.png"),
                SizeMode = PictureBoxSizeMode.AutoSize,
                Location = new Point(28, 175)
            };

            continueGameButton = new Button
            {
                Width    = 200,
                Height   = 65,
                Image    = new Bitmap(@".\Images\PlayMore.png"),
                Location = new Point(100, 285)
            };

            continueGameButton.BringToFront();

            continueGameButton.Click += (sender, args) =>
            {
                this.Hide();
                var gameForm = new Level2();
                gameForm.ShowDialog();
                this.Close();
            };

            exitGameButton = new Button
            {
                Width    = 200,
                Height   = 65,
                Image    = new Bitmap(@".\Images\ExitGame.png"),
                Location = new Point(100, continueGameButton.Location.Y + continueGameButton.Height + 10),
            };

            exitGameButton.BringToFront();

            exitGameButton.Click += (sender, args) =>
            {
                this.Hide();
                var myMenu = new MyMenu(2);
                myMenu.ShowDialog();
                this.Close();
            };

            Controls.Add(continueGameButton);
            Controls.Add(exitGameButton);
            Controls.Add(textBox);
        }
コード例 #2
0
        public void InitializeComponent()
        {
            BackColor       = Color.FromArgb(42, 212, 0);
            MinimumSize     = new Size(420, 700);
            FormBorderStyle = FormBorderStyle.FixedDialog;
            Width           = 360;
            Height          = 400;

            var backLayer = new PictureBox
            {
                BackColor = Color.FromArgb(37, 189, 0),
                Width     = 282,
                Height    = 700,
                Location  = new Point(60, 0)
            };

            logoImege = new PictureBox
            {
                Image    = new Bitmap(@".\Images\NewLogo.png"),
                SizeMode = PictureBoxSizeMode.AutoSize,
                Location = new Point(27, 2)
            };

            textBox = new PictureBox
            {
                Image    = new Bitmap(@".\Images\TextBoxNew.png"),
                SizeMode = PictureBoxSizeMode.AutoSize,
                Location = new Point(60, 399)
            };

            newGameButton = new Button
            {
                Width    = 199,
                Height   = 65,
                Image    = new Bitmap(@".\Images\NewGameButton.png"),
                Location = new Point(42, logoImege.Height + 18)
            };

            newGameButton.Click += (sender, args) =>
            {
                this.Hide();
                var gameForm = new GameForm();
                gameForm.ShowDialog();
                this.Show();
            };

            continueGameButton = new Button
            {
                Width    = 199,
                Height   = 65,
                Image    = new Bitmap(@".\Images\ContinueGameButton.png"),
                Location = new Point(42, logoImege.Height + 13 * 2 + newGameButton.Height)
            };

            continueGameButton.Click += (sender, args) =>
            {
                this.Hide();
                if (level == 1)
                {
                    var gameForm = new GameForm();
                    gameForm.ShowDialog();
                }
                else if (level == 2)
                {
                    var gameForm = new Level2();
                    gameForm.ShowDialog();
                }
                else
                {
                    var gameForm = new BossLevel();
                    gameForm.ShowDialog();
                }
                this.Show();
            };

            backLayer.Controls.Add(logoImege);
            backLayer.Controls.Add(newGameButton);
            backLayer.Controls.Add(continueGameButton);
            Controls.Add(textBox);
            Controls.Add(backLayer);
        }