Exemplo n.º 1
0
        private void buttonRecord_Click(object sender, EventArgs e)
        {
            MediaPlayerMenu.Ctlcontrols.stop();
            FormRecord formRecord = new FormRecord();

            formRecord.Show();
            this.Hide();
        }
Exemplo n.º 2
0
        private void CheckHP()
        {
            switch (b)
            {
            case 1: pictureBoxHP3.Visible = false; bum.Play(); break;

            case 2: pictureBoxHP2.Visible = false; bum.Play(); break;

            case 3:
            {
                pictureBoxHP1.Visible = false; bum.Play();

                timerDel.Stop();
                timerDel.Dispose();

                timerShot.Stop();
                timerShot.Dispose();

                timerMeteor.Stop();
                timerMeteor.Dispose();

                pictureBoxRocket.Visible = false;
                pictureBoxMeteor.Visible = false;

                MessageBox.Show("GAME OVER" + "\n" + "Ваш счёт:" + score.ToString());
                Form rec = new Form()
                {
                    StartPosition   = FormStartPosition.CenterScreen,
                    Size            = new Size(400, 400),
                    BackgroundImage = Курсо.Properties.Resources.Rec,
                    FormBorderStyle = FormBorderStyle.FixedSingle,
                };
                TextBox Name = new TextBox
                {
                    Location = new Point(220, 100),
                    Text     = "",
                    Size     = new Size(80, 25),
                };
                Label Score = new Label
                {
                    Location = new Point(200, 150),
                    Text     = score.ToString(),
                };
                Label label1 = new Label
                {
                    Location        = new Point(125, 100),
                    Text            = "Введите Имя",
                    ForeColor       = Color.White,
                    BackgroundImage = Курсо.Properties.Resources.Rec,
                };
                Label label2 = new Label
                {
                    Location        = new Point(125, 150),
                    Text            = "Очки",
                    ForeColor       = Color.White,
                    BackgroundImage = Курсо.Properties.Resources.Rec,
                };
                Button ok = new Button
                {
                    Location        = new Point(300, 300),
                    Text            = "OK",
                    ForeColor       = Color.White,
                    BackgroundImage = Курсо.Properties.Resources.Rec,
                    DialogResult    = DialogResult.OK,
                };
                void ButtonOK(object sender, EventArgs e)
                {
                    StreamWriter stream = new StreamWriter("Record.txt", true);

                    stream.Write("{0} {1};", Name.Text, Score.Text);
                    stream.Close();
                    MediaPlayerGame.Ctlcontrols.stop();
                }

                ok.Click += ButtonOK;
                rec.Controls.Add(Name);
                rec.Controls.Add(Score);
                rec.Controls.Add(label1);
                rec.Controls.Add(label2);
                rec.Controls.Add(ok);
                rec.ShowDialog();
                FormRecord formRecord = new FormRecord();
                formRecord.Show();
                this.Hide();
            }
            break;
            }
        }