public Form1() { InitializeComponent(); var b = new Bitmap(pictureBox1.Width, pictureBox1.Height); g = Graphics.FromImage(b); pictureBox1.Image = b; pyramid = new Pyramid(g, new Point(300, 300)); }
private void BorderCrossed(Pyramid p) { if (p.FlowRight && p.A.X >= pictureBox1.Width || !p.FlowRight && p.B.X <= 0) { p.MoveX *= -1; } if (p.FlowDown && p.C.Y >= pictureBox1.Height || !p.FlowDown && p.H.Y <= 0) { p.MoveY *= -1; } }