Ejemplo n.º 1
0
        private void Play(object sender, EventArgs e)
        {
            //int row=0, col=0,mines = 0;//row*col >=18, mines <= row*col/2
            String text = "";
            Form2  f    = null;

            if (easy.Checked)
            {
                row   = col = 9;
                mines = 10;
                text  = "Easy";
            }
            else if (medium.Checked)
            {
                row   = col = 16;
                mines = 40;
                text  = "Medium";
            }
            else if (expert.Checked)
            {
                row   = 30;
                col   = 16;
                mines = 99;
                text  = "Expert";
            }
            else if (customButton.Checked)
            {
                while (true)
                {
                    CustomForm cform = new CustomForm();
                    cform.Owner = this;
                    cform.ShowDialog();
                    //custom = false;

                    if (cform.DialogResult == DialogResult.OK && custom == true)
                    {
                        row   = customRow;
                        mines = customMine;
                        col   = customCol;
                        cform.Close();
                        break;
                    }
                    else if (cform.DialogResult == DialogResult.Cancel)
                    {
                        cform.Close();
                        custom = false;
                        break;
                    }
                }
            }
            else
            {
                return;
            }
            if (customButton.Checked && custom == false)
            {
                return;
            }
            //if()
            // Need to skip this when cancel is selected during custom
            int size = Math.Min(30, 1000 / Math.Max(row, col));

            f       = new Form2(text, row, col, size, mines);
            f.Owner = this;
            f.Show();
        }
Ejemplo n.º 2
0
        private void btnCustom_Click(object sender, EventArgs e)
        {
            CustomForm form = new CustomForm();

            form.ShowDialog();
        }