Exemple #1
0
        private void btnGraficar_Click(object sender, EventArgs e)
        {
            try
            {
                Figura miFigura = null;
                switch (cboTipo.Text)
                {
                case "Linea":
                    miFigura = new Linea((double)numA.Value, (double)numB.Value, (int)numXi.Value, (int)numXf.Value);
                    break;

                case "Circulo":
                    miFigura = new Circulo((int)numR.Value, (int)numOx.Value, -1 * (int)numOy.Value);
                    break;

                case "Parabola":
                    miFigura = new Parabola((double)numA.Value, (double)numB.Value, (double)numC.Value, (int)numXi.Value, (int)numXf.Value, chkInvertir.Checked);
                    break;

                case "Hiperbola":
                    miFigura = new Hiperbola((double)numA.Value, (double)numB.Value, (double)numC.Value, (int)numOx.Value, -1 * (int)numOy.Value, (int)numXi.Value, (int)numXf.Value, chkInvertir.Checked);
                    break;

                case "Elipse":
                    miFigura = new Elipse((int)numOx.Value, -1 * (int)numOy.Value, (int)numA.Value, (int)numB.Value);
                    break;
                }
                Grafica miGrafica = new Grafica(miFigura, (int)numPx.Value);
                miGrafica.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
 public Grafica(Figura f, int px)
 {
     miFigura = f;
     this.px  = px;
     InitializeComponent();
 }