private void SortForm_Paint(object sender, PaintEventArgs e) { try { Bitmap bitmap = sortDraw.Draw(new Size(916, 322), states[N]); Graphics G = CreateGraphics(); G.DrawImage(bitmap, 12, 53); G.Dispose(); } catch (Exception) { } }
private void BubleSort_Click(object sender, EventArgs e) { Sort sort = new Sort(20); List <Position> positions = sender == BubleSort?sort.BubleSort() : sort.ShakerSort(); SortDraw draw = new SortDraw(Output.Size); List <Bitmap> bitmaps = draw.Draw(positions); foreach (var item in bitmaps) { Output.Image = item; Refresh(); Thread.Sleep(400); } }