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 Eventos
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Color_Click(object sender, EventArgs e)
{
BackColor = System.Drawing.Color.Aqua;
}
private void Maximizar_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Maximized;
}
private void Minimizar_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Minimized;
}
private void Mostrar_MouseMove(object sender, EventArgs e)
{
label1.Visible = true;
}
private void button6_Click(object sender, EventArgs e)
{
CheckBox VentanaEventos = new CheckBox();
VentanaEventos.Show();
}
private void button5_Click(object sender, EventArgs e)
{
ListBox VentanaEventos = new ListBox();
VentanaEventos.Show();
}
private void Elegir_Color_Click(object sender, EventArgs e)
{
ColorDialog MyDialog = new ColorDialog();
MyDialog.AllowFullOpen = false;
MyDialog.ShowHelp = true;
MyDialog.Color =label1.ForeColor;
if (MyDialog.ShowDialog() == DialogResult.OK)
label1.ForeColor = MyDialog.Color;
}
private void Elegir_Fuente_Click(object sender, EventArgs e)
{
FontDialog MyDialog = new FontDialog();
MyDialog.AllowSimulations = false;
MyDialog.ShowHelp = true;
MyDialog.Font = label1.Font;
if (MyDialog.ShowDialog() == DialogResult.OK)
label1.Font = MyDialog.Font;
}
}
}
public partial class ListBox : Form
{
public ListBox()
{
InitializeComponent();
}
private void Agregar_Click(object sender, EventArgs e)
{
if ( textBox1.Text =="")
{
MessageBox.Show("Debe ingresar un nombre para poder agregar ");
}
else
{
listBox1.Items.Add(textBox1.Text);
textBox1.Text = "";
}
}
private void Eliminar_Click(object sender, EventArgs e)
{
//Si la lista no está vacía entonces podemos eliminar
if (listBox1.TabIndex < 1)
{
//Eliminamos el elemento que se encuentra seleccionado
listBox1.Items.Remove(listBox1.SelectedItem);
}
}
}
}
public partial class CheckBox : Form
{
public CheckBox()
{
InitializeComponent();
}
public void Validar()
{
String msj = "";
if (TxtBox.Equals("")) {//Si txtID esta vacio
msj += "Por favor digite el Nombre \n";
// TxtBox.requestFocusInWindow();
}
// return msj;//devuelve msj
//validar que el usuario no existe
}
private void button1_Click_1(object sender, EventArgs e)
{
string list = " ";
if (TxtBox.Text == "")
{
MessageBox.Show("Ingrese su nombre");
}
else
list ="Su nombre es:\t" + TxtBox.Text;
if (checkBox1.Checked == true)
{
list = list + "\nUsted es Mayor de edad";
}
if (checkBox2.Checked == true)
{
list = list + "\nTiene hijos";
}
if (checkBox3.Checked == true)
{
list = list + "\nEstudia una Carrera";
}
if (list.Length > 0)
{
MessageBox.Show(list);
}
else
{
MessageBox.Show("No ha seleccionado nada");
}
checkBox1.ThreeState = true;
}
}
}
No hay comentarios:
Publicar un comentario