private void canvas_Paint(object sender, PaintEventArgs e)
        {
            if (qAgent != null)
            {
                displayBox.Text = qAgent.draw_world(e.Graphics);

                switch (qAgent.simspeed)
                {
                case 0:
                    displayBox.Text += Environment.NewLine + "Simulation speed: Slow";
                    break;

                case 1:
                    displayBox.Text += Environment.NewLine + "Simulation speed: Normal";
                    break;

                case 2:
                    displayBox.Text += Environment.NewLine + "Simulation speed: Fast";
                    break;

                case 3:
                    displayBox.Text += Environment.NewLine + "Simulation speed: Very Fast";
                    break;
                }
            }

            canvas.Update();
            // refresh charts
            if (chkCharts.Checked)
            {
                updateCharts();
            }

            // pause process if duration reached
            if (needToStart && duration != 0 && qAgent != null && qAgent.getTickCount() >= duration)
            {
                PauseBtn.PerformClick();
            }
        }