private void btn_Sort_Click(object sender, EventArgs e) { if (!timer1.Enabled && animation == null) { animation = new Animation(pictureBox1.Width, pictureBox1.Height); if (rb_Bubble.Checked) { SortVisualisation.Bubble(array, animation); timer1.Start(); } if (rb_Shaker.Checked) { SortVisualisation.Shaker(array, animation); timer1.Start(); } } }
private void btn_Again_Click(object sender, EventArgs e) { if (timer1.Enabled) { timer1.Stop(); } animation = null; using (gForm = pictureBox1.CreateGraphics()) { gForm.Clear(Color.White); for (int i = 0; i < array.Length; i++) { array[i] = backup[i]; } SortVisualisation.DrawArray(gForm, array); } }