shap junc(shap sh)
 {
     if (sh.x <= 0 || sh.x >= panel1.Width)
     {
         sh.DX *= -1;
     }
     if (sh.y <= 0 || sh.y >= panel1.Height)
     {
         sh.DY *= -1;
     }
     return(sh);
 }
        private void button2_Click(object sender, EventArgs e)
        {
            int x = Int32.Parse(textBox1.Text.Trim());
            int y = Int32.Parse(textBox2.Text.Trim());
            int w = Int32.Parse(textBox3.Text.Trim());
            int h = Int32.Parse(textBox4.Text.Trim());

            SHAP        = new Box(x, y, w, h);
            label8.Text = String.Format("{0:0.000}", SHAP.area());
            SHAP.setpaint(panel1);
            SHAP.Draw();
            arr[i] = SHAP;
            i++;
        }