private void Form1_Load(object sender, EventArgs e)
        {
            Form2 username = new Form2();

            DialogResult ds = username.ShowDialog(this);

            if (ds == DialogResult.OK)
            {
                user_label.Text += username.user_tb.Text;
            }
            else if (ds == DialogResult.Cancel)
            {
                this.Dispose();
            }
            username.Dispose();

            r = new Random();

            //Panel1 adjusts its dimensions according to Form1.
            panel1.Location = new Point(0, panel1.Location.Y);
            panel1.Width    = this.ClientSize.Width;
            panel1.Height   = this.ClientSize.Height - panel1.Location.Y;

            //Default level is easy.
            levels.SelectedIndex = 0;

            //Default time of game is 1 minute.
            times.SelectedIndex = 0;
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            /*            DialogResult result = MessageBox.Show("消します?", "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
             *          if (result == DialogResult.Yes)
             *          {
             *              label1.Text = "yes";
             *          }
             *          else
             *          {
             *              label2.Text = "no";
             *          }*/
            Form2 form2 = new Form2();

            if (form2.ShowDialog() == DialogResult.OK)
            {
                label1.Text = form2.feeling;
            }
            form2.Dispose();
        }