public void CalcularArea() { if (rdRectangulo.Checked) { Point punto1 = new Point(Convert.ToInt16(txtP1x.Text), Convert.ToInt16(txtP1y.Text)); Point punto2 = new Point(Convert.ToInt16(txtP2x.Text), Convert.ToInt16(txtP2y.Text)); r = new Rectangulo(punto1, punto2); lbResAreaRec.Text = r.area().ToString(); } else { Point puntos = new Point(Convert.ToInt16(txtPx.Text), Convert.ToInt16(txtPy.Text)); int radio = int.Parse(txtRadio.Text); c = new Circulo(radio, puntos); lbAreaCir.Text = c.area().ToString(); } }
public void mostrarRec(Rectangulo r) { lapiz = new Pen(colorLapiz); lapiz.Width = 3; g.DrawRectangle(lapiz, r.p1.X, r.p1.Y, r.ancho(), r.alto()); }