Ciencia

Páginas: 7 (1717 palabras) Publicado: 2 de junio de 2012
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 CalculadoraCientifica
{
public partial class Calculadora : Form
{
double Valor1; //-----------Declaracion de Variables
double Valor2;
double Resultado;
bool Inicio = true;
bool Operacion= true;
bool Igual = true;
bool TOperacion = true;
string TipoOperacion;
double Memoria = 0;
double a, b, c;

public Calculadora()
{
InitializeComponent();
}
//--------------------------------Botones Numericos
private void Btn1_Click(object sender, EventArgs e)
{
if (Inicio)
{
TxtPrincipal.Text = "";
TxtPrincipal.Text = "1";
Inicio = false;
}
else
TxtPrincipal.Text =TxtPrincipal.Text + "1";
}

private void Btn2_Click(object sender, EventArgs e)
{
if (Inicio)
{
TxtPrincipal.Text = "";
TxtPrincipal.Text = "2";
Inicio = false;
}
else
TxtPrincipal.Text = TxtPrincipal.Text + "2";
}

private void Btn3_Click(object sender, EventArgs e)
{
if (Inicio)
{
TxtPrincipal.Text = "";
TxtPrincipal.Text = "3";
Inicio = false;
}
else
TxtPrincipal.Text =TxtPrincipal.Text + "3";
}

private void Btn4_Click(object sender, EventArgs e)
{
if (Inicio)
{
TxtPrincipal.Text = "";
TxtPrincipal.Text = "4";
Inicio = false;
}
else
TxtPrincipal.Text = TxtPrincipal.Text + "4";
}

private void Btn5_Click(object sender, EventArgs e)
{
if (Inicio)
{
TxtPrincipal.Text = "";
TxtPrincipal.Text = "5";
Inicio = false;
}
else
TxtPrincipal.Text =TxtPrincipal.Text + "5";
}

private void Btn6_Click(object sender, EventArgs e)
{
if (Inicio)
{
TxtPrincipal.Text = "";
TxtPrincipal.Text = "6";
Inicio = false;
}
else
TxtPrincipal.Text = TxtPrincipal.Text + "6";
}

private void Btn7_Click(object sender, EventArgs e)
{
if (Inicio)
{
TxtPrincipal.Text = "";
TxtPrincipal.Text = "7";
Inicio = false;
}
else
TxtPrincipal.Text =TxtPrincipal.Text + "7";
}

private void Btn8_Click(object sender, EventArgs e)
{
if (Inicio)
{
TxtPrincipal.Text = "";
TxtPrincipal.Text = "8";
Inicio = false;
}
else
TxtPrincipal.Text = TxtPrincipal.Text + "8";
}

private void Btn9_Click(object sender, EventArgs e)
{
if (Inicio)
{
TxtPrincipal.Text = "";
TxtPrincipal.Text = "9";
Inicio = false;
}
else
TxtPrincipal.Text =TxtPrincipal.Text + "9";
}

private void Btn0_Click(object sender, EventArgs e)
{
if (!Inicio)
{
TxtPrincipal.Text = TxtPrincipal.Text + "0";
Inicio = false;
}
}

private void BtnDecimal_Click(object sender, EventArgs e)
{
if (TxtPrincipal.Text.Contains(".")) { }
else
{
TxtPrincipal.Text = TxtPrincipal.Text + ".";
Inicio = false;
}
}
//------------------------Botones C, CE,Retroceso, <span><label style="background: none repeat scroll 0 0 #D1E7EF;border: 1px solid #D1E7EF;border-radius: 9px 9px 9px 9px;box-shadow: 1px 1px 0 #FFFFFF inset; padding: 0 3px;cursor:pointer;z-index:0;" datatype="t">Cambio</label></span> de signo y botones de Memoria
private void BtnCE_Click(object sender, EventArgs e)
{
TxtPrincipal.Text = "";
Inicio = true;
}private void BtnC_Click(object sender, EventArgs e)
{
TxtPrincipal.Text = "0";
TxtPrevio.Text = "";
Inicio = true;
Operacion = true;
Igual = true;
TOperacion = true;
Valor1 = 0;
Valor2 = 0;
Resultado = 0;
}

private void BtnRetroceso_Click(object sender, EventArgs e)
{
if (TxtPrincipal.Text.Length > 1)
TxtPrincipal.Text = TxtPrincipal.Text.Remove(TxtPrincipal.Text.Length - 1,1);

if (TxtPrincipal.Text.Length == 1)
{
TxtPrincipal.Text = "0";
Inicio = true;
}

if (TxtPrincipal.Text == "0") { }

}

private void BtnSigno_Click(object sender, EventArgs e)
{
TxtPrincipal.Text = Convert.ToString(0 - Convert.ToDouble(TxtPrincipal.Text));
}

private void BtnMmenos_Click(object sender, EventArgs e)
{
Memoria = Memoria - Convert.ToDouble(TxtPrincipal.Text);...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Ciencia ciencia
  • Ciencia ciencia
  • Ciencia O Ciencias
  • Ciencias Ciencias
  • Ciencia o No Ciencia
  • la ciencia y las ciencias
  • Ciencias
  • Ciencias

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS