Pagína Web de Figuras(C#)
/*Este codigo primero debe ser creada una biblioteca de clases
y agregar dll a la aplicacion, importar la como una
libreria, asi "using ClassFiguras;" claro sin comillas el nombre es un ejemplo*/
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
if (this.RadioButton1.Checked)
{
this.Label1.Visible = true;
Label1.Text =
"Valor del lado:";
this.TextBox1.Visible = true;
this.TextBox1.Text = "";
this.Label2.Visible = false;
this.TextBox2.Visible = false;
RadioButton2.Checked =
false;
RadioButton3.Checked =
false;
this.CheckBox1.Checked = false;
this.CheckBox2.Checked = false;
ListBox1.Items.Clear();
}
else
{
this.Label1.Visible = false;
this.TextBox1.Visible = false;
this.Label2.Visible = false;
this.TextBox2.Visible = false;
}
}
protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
{
if (this.RadioButton2.Checked)
{
this.Label1.Visible = true;
Label1.Text =
"Valor de la base:";
this.TextBox1.Visible = true;
this.TextBox1.Text = "";
this.Label2.Visible = true;
Label2.Text =
"Valor de la Altura:";
this.TextBox2.Visible = true;
this.TextBox2.Text = "";
RadioButton1.Checked =
false;
RadioButton3.Checked =
false;
this.CheckBox1.Checked = false;
this.CheckBox2.Checked = false;
ListBox1.Items.Clear();
}
else
{
this.Label1.Visible = false;
this.TextBox1.Visible = false;
this.Label2.Visible = false;
this.TextBox2.Visible = false;
}
}
protected void RadioButton3_CheckedChanged(object sender, EventArgs e)
{
if (this.RadioButton3.Checked)
{
this.Label1.Visible = true;
Label1.Text =
"Valor del radio:";
this.TextBox1.Visible = true;
this.TextBox1.Text = "";
RadioButton1.Checked =
false;
RadioButton2.Checked =
false;
this.CheckBox1.Checked = false;
this.CheckBox2.Checked = false;
this.Label2.Visible = false;
this.TextBox2.Visible = false;
ListBox1.Items.Clear();
}
else
{
this.Label1.Visible = false;
this.TextBox1.Visible = false;
this.Label2.Visible = false;
this.TextBox2.Visible = false;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
cuadrado c = new cuadrado();
if (RadioButton1.Checked)
{
if (this.CheckBox1.Checked && this.CheckBox2.Checked)
{
ListBox1.Items.Clear();
c.Lado =
double.Parse(this.TextBox1.Text);
ListBox1.Items.Add(
new ListItem("El area es: " + c.sacaArea()));
ListBox1.Items.Add(
new ListItem( "\nEl perimetro es: " + c.sacaPerimetro()));
}
else if (this.CheckBox1.Checked)
{
ListBox1.Items.Clear();
c.Lado =
double.Parse(this.TextBox1.Text);
ListBox1.Items.Add(
new ListItem("El area es: " + c.sacaArea()));
}
else if (this.CheckBox2.Checked)
{
ListBox1.Items.Clear();
c.Lado =
double.Parse(this.TextBox1.Text);
ListBox1.Items.Add(
new ListItem( "\nEl perimetro es: " + c.sacaPerimetro()));
}
else
{
ListBox1.Items.Clear();
ListBox1.Items.Add(
new ListItem("Selecciona una casilla"));
}
}
else if (RadioButton2.Checked)
{
triangulo t = new triangulo();
if (this.CheckBox1.Checked && this.CheckBox2.Checked)
{
ListBox1.Items.Clear();
t.Lado =
double.Parse(this.TextBox1.Text);
t.Altura =
double.Parse(this.TextBox2.Text);
ListBox1.Items.Add(
new ListItem("El area es: " + t.sacaArea()));
ListBox1.Items.Add(
new ListItem("\nEl perimetro es: " + t.sacaPerimetro()));
}
else if (this.CheckBox1.Checked)
{
ListBox1.Items.Clear();
t.Lado =
double.Parse(this.TextBox1.Text);
t.Altura =
double.Parse(this.TextBox2.Text);
ListBox1.Items.Add(
new ListItem("El area es: " + t.sacaArea()));
}
else if (this.CheckBox2.Checked)
{
ListBox1.Items.Clear();
t.Lado =
double.Parse(this.TextBox1.Text);
ListBox1.Items.Add(
new ListItem("\nEl perimetro es: " + t.sacaPerimetro()));
}
else
{
ListBox1.Items.Clear();
ListBox1.Items.Add(
new ListItem("Selecciona una casilla"));
}
}
else
{
circulo cir = new circulo();
if (this.CheckBox1.Checked && this.CheckBox2.Checked)
{
ListBox1.Items.Clear();
cir.Radio =
double.Parse(this.TextBox1.Text);
ListBox1.Items.Add(
new ListItem("El area es: " + cir.sacaArea()));
ListBox1.Items.Add(
new ListItem("\nEl perimetro es: " + cir.sacaPerimetro()));
}
else if (this.CheckBox1.Checked)
{
ListBox1.Items.Clear();
cir.Radio =
double.Parse(this.TextBox1.Text);
ListBox1.Items.Add(
new ListItem("El area es: " + cir.sacaArea()));
}
else if (this.CheckBox2.Checked)
{
ListBox1.Items.Clear();
cir.Radio =
double.Parse(this.TextBox1.Text);
ListBox1.Items.Add(
new ListItem("\nEl perimetro es: " + cir.sacaPerimetro()));
}
else
{
ListBox1.Items.Clear();
ListBox1.Items.Add(
new ListItem("Selecciona una casilla"));
}
}
}