Objetivo.
Aprender a utilizar el control de caracteres en una textBox al igual que entender el uso de los botones.
Código.
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 Práctica_4
{
public partial class frmPC : Form
{
public frmPC()
{
InitializeComponent();
}
private void btnMostrar_Click(object sender, EventArgs e)
{
txtTexto2.Visible = true;
}
private void btnOcultar_Click(object sender, EventArgs e)
{
txtTexto2.Visible = false;
}
private void btnBloquear_Click(object sender, EventArgs e)
{
txtTexto2.Enabled = false;
}
private void btnDesbloquear_Click(object sender, EventArgs e)
{
txtTexto2.Enabled = true;
}
private void btnEnviar_Click(object sender, EventArgs e)
{
txtTexto2.Text = txtTexto1.Text;
}
private void btnLimpiar_Click(object sender, EventArgs e)
{
txtTexto1.Clear();
txtTexto2.BackColor = System.Drawing.Color.FromName("White");
txtTexto2.Clear();
}
private void btnSalir_Click(object sender, EventArgs e)
{
Close();
}
private void btnColorLetra_Click(object sender, EventArgs e)
{
try
{
txtTexto2.ForeColor = System.Drawing.Color.FromName(comboBox1.Text);
}
catch
{
MessageBox.Show("ELEGIR UN COLOR");
}
}
private void btnColorFuente_Click(object sender, EventArgs e)
{
try
{
txtTexto2.BackColor = System.Drawing.Color.FromName(comboBox1.Text);
}
catch
{
MessageBox.Show("ELEGIR UN COLOR");
}
}
}
}
Autor: Eduardo Saavedra Pérez
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Práctica_4
{
public partial class frmPC : Form
{
public frmPC()
{
InitializeComponent();
}
private void btnMostrar_Click(object sender, EventArgs e)
{
txtTexto2.Visible = true;
}
private void btnOcultar_Click(object sender, EventArgs e)
{
txtTexto2.Visible = false;
}
private void btnBloquear_Click(object sender, EventArgs e)
{
txtTexto2.Enabled = false;
}
private void btnDesbloquear_Click(object sender, EventArgs e)
{
txtTexto2.Enabled = true;
}
private void btnEnviar_Click(object sender, EventArgs e)
{
txtTexto2.Text = txtTexto1.Text;
}
private void btnLimpiar_Click(object sender, EventArgs e)
{
txtTexto1.Clear();
txtTexto2.BackColor = System.Drawing.Color.FromName("White");
txtTexto2.Clear();
}
private void btnSalir_Click(object sender, EventArgs e)
{
Close();
}
private void btnColorLetra_Click(object sender, EventArgs e)
{
try
{
txtTexto2.ForeColor = System.Drawing.Color.FromName(comboBox1.Text);
}
catch
{
MessageBox.Show("ELEGIR UN COLOR");
}
}
private void btnColorFuente_Click(object sender, EventArgs e)
{
try
{
txtTexto2.BackColor = System.Drawing.Color.FromName(comboBox1.Text);
}
catch
{
MessageBox.Show("ELEGIR UN COLOR");
}
}
}
}
Autor: Eduardo Saavedra Pérez
No hay comentarios:
Publicar un comentario