private void RenderButton_Click(object sender, EventArgs e) { _stopFlag = false; var renderer = new Renderer(); Scene scene = SpheresRadio.Checked ? SceneBuilder.Spheres() : SceneBuilder.GeometricFiguresBox(); Stopwatch watch = Stopwatch.StartNew(); renderer.Render( _drawTarget, scene, () => { _display.Invalidate(); Application.DoEvents(); UpdateLabels(); }, RenderPasses, ref _stopFlag); watch.Stop(); RenderTimeLabel.Text = string.Format("{0} min, {1} s, {2} ms", watch.Elapsed.Minutes, watch.Elapsed.Seconds, watch.Elapsed.Milliseconds); }