/// <summary> /// 构造函数 /// </summary> /// <param name="row">单元格所在行</param> /// <param name="col">单元格所在列</param> /// <param name="boxWidth">单元格的宽度(与高度相等)</param> /// <param name="parentBackColor">单元格所在界面的背景颜色,以便于投影渐变更加自然</param> public SudokuCell(int row, int col, int cellWidth, Color parentBackColor) { this._DoCell = new SuDoCell(row, col); this._CellWidth = cellWidth; this._ParentBackColor = parentBackColor; InitializeComponent(); this.InitializeContextMenuStrip(); }
void Squares_TextChanged(object sender, EventArgs e) { SudokuCell control = (SudokuCell)sender; try { SuDoCell c = control.DoCell; this.DoTable.SetValue(c.Row, c.Column, Convert.ToInt32(control.Text)); } catch// (ApplicationException ex) { //this.graphicSudokuBoard[row, col].BackColor = Color.Pink; //this.graphicSudokuBoard[row, col].Focus(); //MessageBox.Show(ex.Message); return; } }