private void runToToolStripMenuItem_Click(object sender, EventArgs e) { RunTo dlg = new RunTo(); dlg.BackColor = this.toolStrip1.BackColor; dlg.Run = runtogen; if (DialogResult.OK == dlg.ShowDialog()) { runtogen = (int)dlg.Run; timer.Enabled = true; } }
private void optionsToolStripMenuItem_Click(object sender, EventArgs e) { DialogBox dlg = new DialogBox(); RunTo run = new RunTo(); run.BackColor = this.toolStrip1.BackColor; dlg.BackColor = this.toolStrip1.BackColor; dlg.Backgr = gPanel1.BackColor; dlg.Forgr = cColor; dlg.Grid = gColor; dlg.Gridx10 = dColor; dlg.TimerInterval = timeInt; dlg.UniHeight = mY; dlg.UniWidth = mX; dlg.GridType = gridT; dlg.LiveCell = LiveCellColor; dlg.DeadCell = DeadCellColor; if (DialogResult.OK == dlg.ShowDialog()) { int oldUniverseY = universe.GetLength(1); int oldUniverseX = universe.GetLength(0); gColor = dlg.Grid; dColor = dlg.Gridx10; cColor = dlg.Forgr; gPanel1.BackColor = dlg.Backgr; LiveCellColor = dlg.LiveCell; DeadCellColor = dlg.DeadCell; timeInt = (int)dlg.TimerInterval; gridT = dlg.GridType; bool[,] temp = new bool[(int)dlg.UniWidth, (int)dlg.UniHeight]; if (dlg.UniHeight < oldUniverseY) { oldUniverseY = (int)dlg.UniHeight; } if (dlg.UniWidth < oldUniverseX) { oldUniverseX = (int)dlg.UniWidth; } for (int y = 0; y < oldUniverseY; y++) { for (int x = 0; x < oldUniverseX; x++) { temp[x, y] = universe[x, y]; } } mX = (int)dlg.UniWidth; mY = (int)dlg.UniHeight; universe = new bool[(int)dlg.UniWidth, (int)dlg.UniHeight]; scratchPad = new bool[(int)dlg.UniWidth, (int)dlg.UniHeight]; for (int y = 0; y < (int)dlg.UniHeight; y++) { for (int x = 0; x < (int)dlg.UniWidth; x++) { universe[x, y] = temp[x, y]; scratchPad[x, y] = temp[x, y]; } } gPanel1.Invalidate(); } }