/// <summary> /// Focus on a specific button by providing the corresponding cell. /// </summary> private void Select(SudokuCell cell) { var button = gamePanel.Controls.Find(cell.ToString(), false).First(); if (button == null) { throw new ArgumentException("Cell did not have a matching control."); } button.Focus(); }
public SudokuButton(SudokuCell cell) { Cell = cell; Font = new Font(SystemFonts.DefaultFont.FontFamily, 20); Size = new Size(40, 40); ForeColor = SystemColors.ControlDarkDark; Location = new Point(Cell.X * 40, Cell.Y * 40); FlatStyle = FlatStyle.Flat; FlatAppearance.BorderColor = Color.Black; TabStop = false; Cell.ValueChanged += cell_ValueChanged; Name = cell.ToString(); }