public Form1()
        {
            InitializeComponent();
            pallete = new Dictionary <int, Brush>();
            pallete.Add(100, Brushes.Blue);
            pallete.Add(90, Brushes.Red);
            pallete.Add(80, Brushes.Green);
            pallete.Add(70, Brushes.Yellow);
            pallete.Add(60, Brushes.Brown);
            pallete.Add(50, Brushes.Pink);
            pallete.Add(40, Brushes.Gray);
            pallete.Add(30, Brushes.Gold);
            a        = new Stack <int>();
            b        = new Stack <int>();
            c        = new Stack <int>();
            disks    = -1;
            pictures = new PictureBox[8];
            PictureBox pictureBox;

            for (int i = 7; i >= 0; i--)
            {
                pictureBox             = new PictureBox();
                pictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                pictureBox.Dock        = System.Windows.Forms.DockStyle.Top;
                pictureBox.Size        = new System.Drawing.Size(86, 50);
                pictures[i]            = pictureBox;
                panel1.Controls.Add(pictureBox);
            }
            pictureBox1.Image = BitmapGenerator.GenerateHanoiTower(new int[0], new int[0], new int[0], pallete);
            finish            = true;
        }
 private void DrawStacks()
 {
     pictureBox1.Image = BitmapGenerator.GenerateHanoiTower(a.ToArray(), b.ToArray(), c.ToArray(), pallete);
     counter++;
     pictures[disks].Image = BitmapGenerator.GenerateNumberImage(pictures[disks].Width, pictures[disks].Height, counter);
     Application.DoEvents();
     Thread.Sleep(900);
 }
        private void ShowStatistic()
        {
            while (!Finish)
            {
                Thread.Sleep(500);
            }
            pictureBox1.Image = BitmapGenerator.GenerateHanoiTower(new int[0], new int[0], new int[0], pallete);
            int pow;

            for (int i = 1; i <= 8; i++)
            {
                pow = (int)Math.Pow(2, i);
                pow--;
                pictures[i - 1].Image = BitmapGenerator.GenerateNumberImage(pictures[i - 1].Width, pictures[i - 1].Height, pow);
            }
        }
        private void Initialize()
        {
            a.Clear();
            b.Clear();
            c.Clear();
            counter = 0;
            int n     = 100;
            int limit = 100 - (disks * 10);

            while (n >= limit)
            {
                a.Push(n);
                n -= 10;
            }
            pictureBox1.Image     = BitmapGenerator.GenerateHanoiTower(a.ToArray(), b.ToArray(), c.ToArray(), pallete);
            pictures[disks].Image = BitmapGenerator.GenerateNumberImage(pictures[disks].Width, pictures[disks].Height, counter);
        }