domingo, 18 de septiembre de 2016

PROPIEDADES DE CONTROL


PRÁCTICA #4

PROPIEDADES DE CONTROL

Objetivo: Elaborar la siguiente aplicación en C# 

DISEÑO DEL PROGRAMA


Código del programa


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");
            }
        }
    }
}

ÁREA DE UN TRIÁNGULO


PRÁCTICA #3

ÁREA DE UN TRIÁNGULO

Objetivo: Diseñar una aplicación en C# que calcule el área de un triángulo. Implementar los botones Calcular, Limpiar y Salir.


DISEÑO DEL PROGRAMA


Código del programa

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_3
{
    public partial class frmAreaTriangulo : Form
    {
        public frmAreaTriangulo()
        {
            InitializeComponent();
        }

        private void btnCalcular_Click(object sender, EventArgs e)
        {
            double a, b, c;
            a = Convert.ToDouble(txtBase.Text);
            b = Convert.ToDouble(txtAltura.Text);
            c = (a * b) / 2;
            txtResultado.Text = Convert.ToString(c);
        }

        private void btnLimpiar_Click(object sender, EventArgs e)
        {
            txtBase.Text = "";
            txtAltura.Text = "";
            txtResultado.Text = "";
        }

        private void btnSalir_Click(object sender, EventArgs e)
        {
            Close();
        }
    }

}

miércoles, 14 de septiembre de 2016

SUMA DE DOS NÚMEROS


PRÁCTICA #2

SUMA DE DOS NÚMEROS

Objetivo: Diseñar en C# un programa que pida dos números y calcule la suma. Además, implementar dos botones, uno para que limpie el textbox y otro para que termine el programa.


DISEÑO DEL PROGRAMA


Código del programa


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_2
{
    public partial class frmSuma : Form
    {
        public frmSuma()
        {
            InitializeComponent();
        }

        private void Calcular_Click(object sender, EventArgs e)
        {
            double a, b, c;
            a = Convert.ToDouble(txtPrimero.Text);
            b = Convert.ToDouble(txtSegundo.Text);
            c = a + b;
            txtResultado.Text = Convert.ToString(c);
        }

        private void Limpiar_Click(object sender, EventArgs e)
        {
            txtPrimero.Text = "";
            txtSegundo.Text = "";
            txtResultado.Text = "";
        }

        private void Salir_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}

martes, 13 de septiembre de 2016

HOLA MUNDO


PRÁCTICA #1

HOLA MUNDO
Objetivo: Diseñar un programa en C# que cuando el usuario presione un botón se visualice un mensaje.

DISEÑO DEL PROGRAMA


Código del programa

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_1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("HOLA MUNDO");
        }
    }
}