private void newConfigurationToolStripMenuItem_Click(object sender, EventArgs e) { this.grid.CreateGraphics().Clear(Color.FromKnownColor(KnownColor.Control)); var s = Grid.GetSizeOfGrid(Properties.Settings.Default.GridSize); g = new Grid(Properties.Settings.Default.GridSize); this.Size = new Size(s.Width + 21, s.Height + 90); Timer t = new Timer(); t.Interval = 100; t.Tick += new EventHandler((_sender, _e) => { t.Stop(); g.BlockBorders(this.grid); g.Draw(this.grid.CreateGraphics()); __last_valid_grid_block = g.abs2grid(g.AgentPoint); MarkStartPointGrid_Click(new object(), new EventArgs()); __last_valid_grid_block = g.abs2grid(g.GoalPoint); MarkGoalPointGrid_Click(new object(), new EventArgs()); }); t.Start(); }