Anda di halaman 1dari 30

Instituto tecnológico superior del

sur del estado de Yucatán

Ingeniería en sistemas
computacionales

Tópicos avanzados de programación

Profesor: Jorge Ángel Santamaría magaña


Portafolio de evidencias
Cuarto semestre

Grupo: “B”

Trabajo realizado por:


Ake Colli Silvia Beatriz
MOUSE BOTON IZQUIERDA DERECHA.
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 Eventos
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

String vNombre = "admin";


String vPass = "admin";
string vNombre_Ingresado = "";
string vPass_Ingresado = "";

private void textBoxCaptura_KeyPress(object sender, KeyPressEventArgs e)


{
//LEEMOS EL VALOR DE LA TECLA PULSADA Y SI CORRESPONDE
//A LA DESEADA ENTONCES HACEMOS ALGO
if (e.KeyChar == Convert.ToChar(Keys.A))
{
MessageBox.Show("Presionaste la tecla A");
btnSaludar.PerformClick();
}
else { }
}

private void textBoxCaptura_KeyDown(object sender, KeyEventArgs e)


{

switch (e.KeyCode) {
case Keys.Escape:
MessageBox.Show("Presionaste la tecla ESC en la caja de texto 1");
break;
}
}

private void textBox1_KeyDown(object sender, KeyEventArgs e)


{
switch (e.KeyCode)
{

case Keys.Escape:
MessageBox.Show("Presionaste la tecla ESC en la caja de texto 2");
break;
}
}

private void btnSaludar_Click(object sender, EventArgs e)


{
MessageBox.Show("HOLA MUNDO");
}

private void btnAceptar_Click(object sender, EventArgs e)


{
if (textBoxUsuario.Text == "") {
MessageBox.Show("Debes ingresar el nombre de usuario");

return;

if (textBoxContrasenia.Text == "")
{
MessageBox.Show("Debes ingresar el nombre de Contraseña");
return;

}
//si llegamos aqui entonces hay datos en las cajas de texto
vNombre_Ingresado = textBoxUsuario.Text;
vPass_Ingresado = textBoxContrasenia.Text;

if (vNombre == vNombre_Ingresado)
{
//todo bien
}
else {
MessageBox.Show("Nombre de usuario incorrecto");
return;

}
//si llega aqui solo nos falta la contraseña

if (vPass == vPass_Ingresado)
{
//todo bien
}
else
{
MessageBox.Show("Contraseña incorrecta");
return;

MessageBox.Show("Bienvenido usuario: " + vNombre);


}

private void textBoxContrasenia_KeyPress(object sender, KeyPressEventArgs


e)
{
if (e.KeyChar == Convert.ToChar(Keys.Enter))
{

btnAceptar.PerformClick();
}
else { }
}

private void textBoxUsuario_KeyDown(object sender, KeyEventArgs e)


{
switch (e.KeyCode)
{

case Keys.Enter:
textBoxContrasenia.Focus();
break;

case Keys.Escape:
btnCancelar.PerformClick();
break;
}
}

private void textBoxContrasenia_KeyDown(object sender, KeyEventArgs e)


{
switch (e.KeyCode)
{

case Keys.Escape:
btnCancelar.PerformClick();
break;
}
}

private void btnCancelar_Click(object sender, EventArgs e)


{
Close();
}

}
}
INTERFAZ DE USUARIO(KeyPress, KeyDow, 5 intentos)
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 Eventos
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

String vNombre = "admin";


String vPass = "admin";
string vNombre_Ingresado = "";
string vPass_Ingresado = "";
int contador = 0;
int descontar=5;
private void textBoxCaptura_KeyPress(object sender, KeyPressEventArgs e)
{
//LEEMOS EL VALOR DE LA TECLA PULSADA Y SI CORRESPONDE
//A LA DESEADA ENTONCES HACEMOS ALGO
if (e.KeyChar == Convert.ToChar(Keys.A))
{
MessageBox.Show("Presionaste la tecla A");
btnSaludar.PerformClick();
}
else { }
}

private void textBoxCaptura_KeyDown(object sender, KeyEventArgs e)


{

switch (e.KeyCode) {

case Keys.Escape:
MessageBox.Show("Presionaste la tecla ESC en la caja de texto 1");
break;
}
}

private void textBox1_KeyDown(object sender, KeyEventArgs e)


{
switch (e.KeyCode)
{

case Keys.Escape:
MessageBox.Show("Presionaste la tecla ESC en la caja de texto 2");
break;
}
}

private void btnSaludar_Click(object sender, EventArgs e)


{
MessageBox.Show("HOLA MUNDO");
}

private void btnAceptar_Click(object sender, EventArgs e)


{
if (descontar== 1)
{
this.Close();
}

if (textBoxUsuario.Text == "") {
MessageBox.Show("Debes ingresar el nombre de usuario");

return;

if (textBoxContrasenia.Text == "")
{
MessageBox.Show("Debes ingresar el nombre de Contraseña");

return;

}
//si llegamos aqui entonces hay datos en las cajas de texto
vNombre_Ingresado = textBoxUsuario.Text;
vPass_Ingresado = textBoxContrasenia.Text;

if (vNombre == vNombre_Ingresado)
{
//todo bien
}
else {
MessageBox.Show("Nombre de usuario incorrecto");
contador++;
descontar--;
progressBar2.Value = contador;

MessageBox.Show("tienes " + descontar + " intentos");


return;

//si llega aqui solo nos falta la contraseña

if (vPass == vPass_Ingresado)
{
//todo bien
}
else
{
MessageBox.Show("Contraseña incorrecta");
contador++;
descontar--;
progressBar2.Value = contador;
MessageBox.Show("tienes " + descontar + " intentos");
return;

MessageBox.Show("Bienvenido usuario: " + vNombre);

private void textBoxContrasenia_KeyPress(object sender, KeyPressEventArgs


e)
{
if (e.KeyChar == Convert.ToChar(Keys.Enter))
{

btnAceptar.PerformClick();
}
else { }
}

private void textBoxUsuario_KeyDown(object sender, KeyEventArgs e)


{

switch (e.KeyCode)
{

case Keys.Enter:
textBoxContrasenia.Focus();
break;

case Keys.Escape:
btnCancelar.PerformClick();
break;
}

private void textBoxContrasenia_KeyDown(object sender, KeyEventArgs e)


{
switch (e.KeyCode)
{

case Keys.Escape:
btnCancelar.PerformClick();
break;
}
}

private void btnCancelar_Click(object sender, EventArgs e)


{
Close();
}

private void Form1_KeyDown(object sender, KeyEventArgs e)


{
switch (e.KeyCode)
{

case Keys.Escape:
btnCancelar.PerformClick();
break;
}

private void progressBar2_Click(object sender, EventArgs e)


{

}
}
CEMAFORO

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace silviforo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

string vLedVerde = "";


string vLedRojo = "";
string vLedAmarrillo = "";
string vLedActivo = "";

private void timer1_Tick(object sender, EventArgs e)


{
switch (vLedActivo)
{
case "R":

timer1.Interval = 3000;
pictureBoxRojo.Visible = true;
pictureBoxAmarrillo.Visible = false;
pictureBoxVerde.Visible = false;
label1.Text = "ALTO";

pictureBoxRed.Visible = false;
pictureBoxYellow.Visible = false;
pictureBoxGreen.Visible = true;
label2.Text = "CONTINUE";

//label1.Text = "alto";
vLedActivo = "A";
break;
case "A":
timer1.Interval = 1000;
pictureBoxAmarrillo.Visible = false;
pictureBoxVerde.Visible = false;
pictureBoxRojo.Visible = true;
label1.Text = "ALTO";

pictureBoxYellow.Visible = true;
pictureBoxRed.Visible = false;
pictureBoxGreen.Visible = false;
label2.Text = "PRECAUCION";
vLedActivo = "V";

break;

case "A2":
timer1.Interval = 1000;
pictureBoxAmarrillo.Visible = true;
pictureBoxVerde.Visible = false;
pictureBoxRojo.Visible = false;
label1.Text = "PRECAUCION";

pictureBoxYellow.Visible = false;
pictureBoxRed.Visible = true;
pictureBoxGreen.Visible = false;
label2.Text = "PRECAUCION";
vLedActivo = "R";

break;

case "V":
timer1.Interval = 3000;
pictureBoxVerde.Visible = true;
pictureBoxAmarrillo.Visible = false;
pictureBoxRojo.Visible = false;
label1.Text = "CONTINUE";

pictureBoxGreen.Visible = false;
pictureBoxYellow.Visible = false;
pictureBoxRed.Visible = true;
label2.Text = "ALTO";

vLedActivo = "A2";
break;
}
}

private void Form1_Load(object sender, EventArgs e)


{
pictureBoxGreen.Visible = true;
pictureBoxRojo.Visible = true;

vLedActivo = "R";

timer1.Start();

}
}
Ensayo de:
Tipos de eventos
Investigación: reglas de oro en el diseño de interfaz de
sistemas de usuario.
Propuesta de diseño.

Anda mungkin juga menyukai