void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            SimulateWorld();
            float width = 3;
            float hh    = ViewBounds.Width * pictureBox1.Height / pictureBox1.Width;

            if (ViewBounds.Height != hh)
            {
                ViewBounds.Y      = ViewBounds.Y + ViewBounds.Height / 2 - hh / 2;
                ViewBounds.Height = hh;
            }



            g.ScaleTransform((float)pictureBox1.Width / ViewBounds.Width, (float)pictureBox1.Height / ViewBounds.Height);
            g.TranslateTransform(-ViewBounds.X, -ViewBounds.Y);

            float w   = 200 / 10;
            float h   = 200 / 10;
            Pen   pen = new Pen(Color.LightBlue, 0.0F);

            for (int x = 0; x < 11; x++)
            {
                g.DrawLine(pen, -100 + x * w, -100, -100 + x * w, 100);
            }
            for (int y = 0; y < 11; y++)
            {
                g.DrawLine(pen, -100, -100 + y * h, 100, -100 + y * h);
            }

            Pen pen2 = new Pen(Color.Red, 0.0F);

            PaintCommands.g = g;
            for (int i = 0; i < WorldActors.Count; i++)
            {
                ActorData actor = WorldActors[i];
                PaintCommands.loc   = actor.ActorLocation;
                PaintCommands.args1 = actor.PainterArgs1;
                PaintCommands.args2 = actor.PainterArgs2;
                actor.ActorPainter();
                if (SelectedActors.Contains(i))
                {
                    float width2 = PaintCommands.resultedWidth + 1;
                    g.DrawRectangle(pen2, actor.ActorLocation.X - width2 / 2, actor.ActorLocation.Y - width2 / 2, width2, width2);
                }
            }

            PaintCommands.g = null;
            g.ResetTransform();
            if (ShowSelectionRect)
            {
                g.DrawRectangle(pen2, CurrentSelectionFrom.X, CurrentSelectionFrom.Y, CurrentSelectionTo.X - CurrentSelectionFrom.X, CurrentSelectionTo.Y - CurrentSelectionFrom.Y);
            }

            pictureBox1.Invalidate();
        }
 public static int SortByLayer(ActorData a, ActorData b)
 {
     return a.layer.CompareTo(b.layer);
 }
 public static int SortByLayer(ActorData a, ActorData b)
 {
     return(a.layer.CompareTo(b.layer));
 }