private void muyFacilToolStripMenuItem_Click(object sender, EventArgs e) { SudokuCreator Creator = new SudokuCreator(); int Difficulty = 1; int TargetDel = 32; Sudoku Created = Creator.CreateRandomSudoku(Difficulty, 81 - TargetDel); Display(Created); }
private void frmMainFrame_Load(object sender, EventArgs e) { Texts = new TextBox[Dimension][]; for (int i = 0; i < Dimension; i++) { Texts[i] = new TextBox[Dimension]; for (int j = 0; j < Dimension; j++) { Texts[i][j] = new TextBox(); this.Controls.Add(Texts[i][j]); Texts[i][j].Name = i.ToString() + j.ToString(); Texts[i][j].Multiline = true; Texts[i][j].Width = TextsSize; Texts[i][j].Height = TextsSize; if (j == 0) Texts[i][j].Left = 3; else if (j % 3 == 0) Texts[i][j].Left = Texts[i][j - 1].Left + TextsSize + 6; else Texts[i][j].Left = Texts[i][j - 1].Left + TextsSize + 2; if (i == 0) Texts[i][j].Top = 30; else if (i % 3 == 0) Texts[i][j].Top = Texts[i - 1][j].Top + TextsSize + 6; else Texts[i][j].Top = Texts[i - 1][j].Top + TextsSize + 2; Texts[i][j].BorderStyle = BorderStyle.None; Texts[i][j].TextAlign = HorizontalAlignment.Center; Font miFuente = new Font("Microsoft Sans Serif", FontSize); Texts[i][j].Font = miFuente; Texts[i][j].ReadOnly = true; Texts[i][j].BackColor = Color.White; Texts[i][j].MaxLength = 1; Texts[i][j].KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Texts_KeyPress); Texts[i][j].TextChanged += new System.EventHandler(this.Texts_Changed); } } if(probando) { SudokuCreator Creator = new SudokuCreator(); Sudoku Created = Creator.CreateRandomSudoku(1, 3); Display(Created); } }