/// <summary> /// Reset to the initial state (before the maze is solved). /// </summary> public void Reset() { //this.BackColor = Color.Black; painter.Reset(); painter.BlinkingCounter = 0; if (allowUpdates) { this.Invalidate(); } // If the window is minimized, there will be no OnPaint() event. // Therefore we paint the maze directly. // Note: When used by a ScreenSaverController, ParentForm will be null. if (this.ParentForm == null || this.ParentForm.WindowState == FormWindowState.Minimized) { // TODO: Reset() is called twice but should be called only once. painter.PaintMaze(this.PaintImages); } }
/// <summary> /// Creates a new maze. /// </summary> public void OnNew(object sender, EventArgs e) { #region Set up the painter. painter.Setup(); int squareWidth; int pathWidth; int wallWidth; MazePainter.SuggestWidths(painter.GridWidth, painter.VisibleWalls, out squareWidth, out pathWidth, out wallWidth); painter.Setup(squareWidth, wallWidth, pathWidth); #endregion painter.Reset(); painter.BlinkingCounter = 0; // Create and display a maze. painter.CreateMaze(null); painter.PaintMaze(null); }