Ejemplo n.º 1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            x = textBox1.Text == "" ? x = 0 : Convert.ToInt32(textBox1.Text);
            y = textBox2.Text == "" ? y = 0 : Convert.ToInt32(textBox2.Text);
            a = textBox4.Text == "" ? a = 0 : Convert.ToInt32(textBox4.Text);
            b = textBox3.Text == "" ? b = 0 : Convert.ToInt32(textBox3.Text);
            h = textBox5.Text == "" ? h = 0 : Convert.ToInt32(textBox5.Text);

            panel1.Controls.Clear();
            panel1.Refresh();

            Pen   redPen   = new Pen(Color.Red, 1);
            Brush redBrush = new SolidBrush(Color.Green);

            switch (comboBox1.Text)
            {
            case "Square":

                Square sponge_bob = new Square(a, x, y);
                kartina.figurki.Add(sponge_bob);

                // kartina.figurki[0].Draw(redPen, panel1);
                sponge_bob.Draw(redPen, panel1);
                break;

            case "Rectangle":
                Rect keker = new Rect(a, b, x, y);
                kartina.figurki.Add(keker);

                //kartina.figurki[2].Draw(redPen, panel1);
                keker.Draw(redPen, panel1);
                break;

            case "Shady Rectangle":

                Rect_Stretched grill = new Rect_Stretched(a, b, x, y);
                kartina.figurki.Add(grill);

                grill.Draw(redPen, panel1);
                //kartina.figurki[1].Draw(redPen, panel1);

                break;

            case "Cube":
                Cube rubick = new Cube(30, 100, 100);
                kartina.figurki.Add(rubick);
                rubick.Draw(redPen, panel1);
                //  kartina.figurki[3].Draw(redPen, panel1);
                break;

            case "Quad Pyramid":
                Quad_pyramid squad = new Quad_pyramid(a, h, x, y);
                kartina.figurki.Add(squad);
                squad.Draw(redPen, panel1);
                //  kartina.figurki[4].Draw(redPen, panel1);
                break;

            case "Cuboid":
                Cuboid cuba = new Cuboid(a, b, h, x, y);
                kartina.figurki.Add(cuba);
                cuba.Draw(redPen, panel1);
                // kartina.figurki[5].Draw(redPen, panel1);
                break;
            }
        }
Ejemplo n.º 2
0
 private void shading(Rect_Stretched kek)
 {
 }