jueves, 22 de abril de 2010
elevador simulador
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
{
int direccion;
public Form1()
{
InitializeComponent();
direccion = 0;
}
private void button1_Click(object sender, EventArgs e)
{
direccion = direccion + 1;
textBox1.Text = direccion.ToString();
if (direccion == 15)
{
button1.Enabled = false;
button2.Enabled = true;
}
else
if (direccion == 2)
{
button2.Enabled = true;
}
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
direccion = direccion - 1;
textBox1.Text = direccion.ToString();
if(direccion==1)
{
button2.Enabled = false;
button1.Enabled = true;
}
else
if (direccion == 14)
{
button1.Enabled = true;
}
}
private void button3_Click(object sender, EventArgs e)
{
if (direccion == 1)
{
pictureBox1.Visible = true;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
pictureBox10.Visible = false;
pictureBox11.Visible = false;
pictureBox12.Visible = false;
pictureBox13.Visible = false;
pictureBox14.Visible = false;
pictureBox15.Visible = false;
MessageBox.Show("Primer piso planta , Gracias por su preferencia","destino");
}
if (direccion == 2)
{
pictureBox2.Visible = true;
pictureBox1.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
pictureBox10.Visible = false;
pictureBox11.Visible = false;
pictureBox12.Visible = false;
pictureBox13.Visible = false;
pictureBox14.Visible = false;
pictureBox15.Visible = false;
MessageBox.Show("segundo piso, Gracias por su preferencia","destino");
}
if (direccion == 3)
{
pictureBox3.Visible = true;
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
pictureBox10.Visible = false;
pictureBox11.Visible = false;
pictureBox12.Visible = false;
pictureBox13.Visible = false;
pictureBox14.Visible = false;
pictureBox15.Visible = false;
MessageBox.Show("tercer piso, Gracias por su preferencia", "destino");
}
if (direccion == 4)
{
pictureBox4.Visible = true;
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
pictureBox10.Visible = false;
pictureBox11.Visible = false;
pictureBox12.Visible = false;
pictureBox13.Visible = false;
pictureBox14.Visible = false;
pictureBox15.Visible = false;
MessageBox.Show("cuarto piso, Gracias por su preferencia", "destino");
}
if (direccion == 5)
{
pictureBox5.Visible = true;
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
pictureBox10.Visible = false;
pictureBox11.Visible = false;
pictureBox12.Visible = false;
pictureBox13.Visible = false;
pictureBox14.Visible = false;
pictureBox15.Visible = false;
MessageBox.Show("quinto piso, Gracias por su preferencia", "destino");
}
if (direccion == 6)
{
pictureBox6.Visible = true;
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
pictureBox10.Visible = false;
pictureBox11.Visible = false;
pictureBox12.Visible = false;
pictureBox13.Visible = false;
pictureBox14.Visible = false;
pictureBox15.Visible = false;
MessageBox.Show("sexto piso, Gracias por su preferencia", "destino");
}
if (direccion == 7)
{
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = true;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
pictureBox10.Visible = false;
pictureBox11.Visible = false;
pictureBox12.Visible = false;
pictureBox13.Visible = false;
pictureBox14.Visible = false;
pictureBox15.Visible = false;
MessageBox.Show("septimo piso, Gracias por su preferencia", "destino");
}
if (direccion == 8)
{
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = true;
pictureBox9.Visible = false;
pictureBox10.Visible = false;
pictureBox11.Visible = false;
pictureBox12.Visible = false;
pictureBox13.Visible = false;
pictureBox14.Visible = false;
pictureBox15.Visible = false;
MessageBox.Show("octavo piso, Gracias por su preferencia", "destino");
}
if (direccion == 9)
{
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = true;
pictureBox10.Visible = false;
pictureBox11.Visible = false;
pictureBox12.Visible = false;
pictureBox13.Visible = false;
pictureBox14.Visible = false;
pictureBox15.Visible = false;
MessageBox.Show("noveno piso, Gracias por su preferencia", "destino");
}
if (direccion == 10)
{
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
pictureBox10.Visible = true;
pictureBox11.Visible = false;
pictureBox12.Visible = false;
pictureBox13.Visible = false;
pictureBox14.Visible = false;
pictureBox15.Visible = false;
MessageBox.Show("decimo piso, Gracias por su preferencia", "destino");
}
if (direccion == 11)
{
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
pictureBox10.Visible = false;
pictureBox11.Visible = true;
pictureBox12.Visible = false;
pictureBox13.Visible = false;
pictureBox14.Visible = false;
pictureBox15.Visible = false;
MessageBox.Show("decimo primer piso, Gracias por su preferencia", "destino");
}
if (direccion == 12)
{
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
pictureBox10.Visible = false;
pictureBox11.Visible = false;
pictureBox12.Visible = true;
pictureBox13.Visible = false;
pictureBox14.Visible = false;
pictureBox15.Visible = false;
MessageBox.Show("decimo segundo piso, Gracias por su preferencia", "destino");
}
if (direccion == 13)
{
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
pictureBox10.Visible = false;
pictureBox11.Visible = false;
pictureBox12.Visible = false;
pictureBox13.Visible = true;
pictureBox14.Visible = false;
pictureBox15.Visible = false;
MessageBox.Show("decimo tercer piso, Gracias por su preferencia", "destino");
}
if (direccion == 14)
{
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
pictureBox10.Visible = false;
pictureBox11.Visible = false;
pictureBox12.Visible = false;
pictureBox13.Visible = false;
pictureBox14.Visible = true;
pictureBox15.Visible = false;
MessageBox.Show("decimo cuarto piso, Gracias por su preferencia", "destino");
}
if (direccion == 15)
{
pictureBox1.Visible = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
pictureBox5.Visible = false;
pictureBox6.Visible = false;
pictureBox7.Visible = false;
pictureBox8.Visible = false;
pictureBox9.Visible = false;
pictureBox10.Visible = false;
pictureBox11.Visible = false;
pictureBox12.Visible = false;
pictureBox13.Visible = false;
pictureBox14.Visible = false;
pictureBox15.Visible = true;
MessageBox.Show("decimo quinto piso, Gracias por su preferencia", "destino");
}
}
}
}
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario