lunes, 2 de marzo de 2009

Hoja 3 Problema1 (visual)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int opcion;
opcion = int.Parse(comboBox1.Text);
switch (opcion)
{
case 1: Form2 f2= new Form2();
f2.Show();
break;
case 2: Form3 f3= new Form3();
f3.Show();
break;
case 3: Form4 f4= new Form4();
f4.Show();
break;
case 4: Form5 f5 = new Form5();
f5.Show();
break;
}
}
}
}


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int lado, area, perimetro;
lado=int.Parse(textBox1.Text);
area = lado * lado;
perimetro = lado * 4;
textBox2.Visible = true;
textBox2.Text= ( area.ToString());
textBox3.Visible = true;
textBox3.Text=(perimetro.ToString());
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox1.Focus();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
} using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int largo,ancho, area, perimetro;
largo = int.Parse(textBox1.Text);
ancho = int.Parse(textBox2.Text);
area = largo * ancho;
perimetro = (largo * 2)+(ancho*2);
textBox3.Visible = true;
textBox3.Text = (area.ToString());
textBox4.Visible = true;
textBox4.Text = (perimetro.ToString());
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox1.Focus();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double lado1, lado2, lado3,area, perimetro, semiperimetro;
lado1 = double.Parse(textBox1.Text);
lado2 = double.Parse(textBox2.Text);
lado3 = double.Parse(textBox3.Text);
perimetro = (lado1 + lado2 + lado3);
semiperimetro = (perimetro / 2);
area = (Math.Sqrt((semiperimetro) * (semiperimetro - lado1) * (semiperimetro - lado2) * (semiperimetro - lado3)));
textBox4.Visible = true;
textBox4.Text = (area.ToString());
textBox5.Visible = true;
textBox5.Text = (perimetro.ToString());
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
textBox5.Clear();
textBox1.Focus();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double radio, area, perimetro;
radio = int.Parse(textBox1.Text);
area = ((Math.PI)*(Math.Pow(radio,2)));
perimetro = (2*Math.PI*radio);
textBox2.Visible = true;
textBox2.Text = (area.ToString());
textBox3.Visible = true;
textBox3.Text = (perimetro.ToString());
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox1.Focus();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
}
}
}

No hay comentarios:

Publicar un comentario