Esempio n. 1
0
        private void SudokuControl_Paint(object sender, PaintEventArgs e)
        {
            try
            {
                SudokuGrid grid = Grid;

                // Keep form designer happy
                if (grid == null)
                {
                    grid = new SudokuGrid(new SudokuGrid.GridOptions(3, 3, '1'));
                }

                using (PaintContext context = new PaintContext(e.Graphics, Size, grid, selx, sely))
                {
                    grid.Paint(context);
                }
            }
            catch (Exception ex)
            {
                e.Graphics.DrawString("! " + ex.ToString(), Font, Brushes.Red, 0, 0);
            }
        }