示例#1
0
        private void RandomHandler(object sender, EventArgs e)
        {
            ChoosePuzzleSize chooseSize = new ChoosePuzzleSize();

            chooseSize.Text   = "New Random Puzzle";
            chooseSize.width  = m;
            chooseSize.height = n;
            chooseSize.ShowDialog();
            int height = chooseSize.height, width = chooseSize.width;

            if (height == 0)
            {
                return;
            }


            n         = height;
            m         = width;
            gameMode  = GameMode.PlayMode;
            fieldstat = new FieldStat[n, m];
            Point Pos = new Point(this.Width / 2, this.Height / 2);

            DrawWinSeq();
            CreateLayoutPanel(Pos);
            CreateButtons();
            CreateLebels(Pos);
        }
示例#2
0
        private void CreatePuzzleHandler(object sender, EventArgs e)
        {
            ChoosePuzzleSize chooseSize = new ChoosePuzzleSize();

            chooseSize.width  = m;
            chooseSize.height = n;
            chooseSize.ShowDialog();
            int height = chooseSize.height, width = chooseSize.width;

            if (height == 0)
            {
                return;
            }
            Controls.RemoveByKey("TableLayoutPanel");
            for (int i = 0; i < n + m; i++)
            {
                Controls.Remove(labels[i]);
            }
            n         = height;
            m         = width;
            gameMode  = GameMode.CreateMode;
            fieldstat = new FieldStat[n, m];
            Point Pos = new Point(this.Width - 10 * CELLSIZ, this.Height - 11 * CELLSIZ);

            CreateLayoutPanel(Pos);
            CreateButtons();
            CreateLebels(Pos);

            groupBox          = new GroupBox();
            groupBox.Text     = "Puzzle Settings";
            groupBox.Size     = new Size(275, 150);
            groupBox.Location = new Point(30, 60);

            Label puzzletitle = new Label();

            puzzletitle.Text     = "Puzzle Title";
            puzzletitle.Size     = new Size(puzzletitle.PreferredWidth, puzzletitle.PreferredHeight);
            puzzletitle.Location = new Point(10, 30);
            groupBox.Controls.Add(puzzletitle);

            title          = new TextBox();
            title.Size     = new Size(130, 27);
            title.Location = new Point(140, 30);
            groupBox.Controls.Add(title);

            Label difficulty = new Label();

            difficulty.Text     = "Dificulty";
            difficulty.Size     = new Size(difficulty.PreferredWidth, difficulty.PreferredHeight);
            difficulty.Location = new Point(10, 70);
            groupBox.Controls.Add(difficulty);

            diff          = new TextBox();
            diff.Size     = new Size(130, 27);
            diff.Location = new Point(140, 70);
            groupBox.Controls.Add(diff);

            Button save = new Button();

            save.Size     = new Size(95, 30);
            save.Location = new Point(175, 115);
            save.Text     = "Save";
            save.Click   += SaveButtonClick;
            groupBox.Controls.Add(save);

            Controls.Add(groupBox);
        }