public Board(SingleplayerGame form)
        {
            this.ColumnCount = 3;
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));

            this.RowCount = 3;
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));

            this.Location = new System.Drawing.Point(0, 45);
            this.Name     = "Board";
            this.Size     = new System.Drawing.Size(this.width, this.height);

            for (int i = 0; i < 9; i++)
            {
                Cell tmpCell = new Cell(i);
                tmpCell.TabStop   = false;
                tmpCell.Font      = new Font(tmpCell.Font.FontFamily, 70);
                tmpCell.FlatStyle = FlatStyle.System;
                tmpCell.Click    += form.Button_Clicked;
                tmpCell.AutoSize  = false;
                tmpCell.Size      = new System.Drawing.Size(this.width / 3, this.height / 3);
                this.Controls.Add(tmpCell);
            }
        }
示例#2
0
        private void Single_Click(object sender, EventArgs e)
        {
            SingleplayerGame gameForm = new SingleplayerGame();

            gameForm.StartPosition = FormStartPosition.Manual;
            gameForm.Location      = this.Location;
            this.Hide();
            gameForm.Show();
        }