using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 计算器
{
public partial class Form1 : Form
{
Boolean IsAOrB = true;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double InputNumber, ResuIt;
InputNumber = Convert.ToDouble(InputA.Text);
ResuIt = Math.Sin(InputNumber);
InputB.Text = ResuIt.ToString();
}
private void button3_Click(object sender, EventArgs e)
{
double InputNumber, ResuIt;
InputNumber = Convert.ToDouble(InputA.Text);
ResuIt = Math.Cos(InputNumber);
InputB.Text = ResuIt.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
double InputNumber, ResuIt;
InputNumber = Convert.ToDouble(InputA.Text);
ResuIt = Math.Tan(InputNumber);
InputB.Text = ResuIt.ToString();
}
private void button4_Click(object sender, EventArgs e)
{
double InputNumber, ResuIt;
InputNumber = Convert.ToDouble(InputA.Text);
ResuIt = InputNumber * InputNumber;
InputB.Text = ResuIt.ToString();
}
private void button5_Click(object sender, EventArgs e)
{
double InputNumber, ResuIt;
InputNumber = Convert.ToDouble(InputA.Text);
ResuIt = InputNumber * InputNumber * InputNumber;
InputB.Text = ResuIt.ToString();
}
private void button6_Click(object sender, EventArgs e)
{
double InputNumber, ResuIt;
InputNumber = Convert.ToDouble(InputA.Text);
ResuIt = Math.Sqrt(InputNumber); ;
InputB.Text = ResuIt.ToString();
}
private void button7_Click(object sender, EventArgs e)
{
double InputNumber, ResuIt;
InputNumber = Convert.ToDouble(InputA.Text);
ResuIt = Math.Log10(InputNumber);
InputB.Text = ResuIt.ToString();
}
private void notbutton17_Click(object sender, EventArgs e)
{
if (IsAOrB == true)
InputA.Text += "0";
else
InputB.Text += "0";
}
private void button9_Click(object sender, EventArgs e)
{
if (IsAOrB == true)
InputA.Text += "1";
else
InputB.Text += "1";
}
private void Numberbutton2_Click(object sender, EventArgs e)
{
if (IsAOrB == true)
InputA.Text += "2";
else
InputB.Text += "2";
}
private void Numberbutton3_Click(object sender, EventArgs e)
{
if (IsAOrB == true)
InputA.Text += "3";
else
InputB.Text += "3";
}
private void Numberbutton4_Click(object sender, EventArgs e)
{
if (IsAOrB == true)
InputA.Text += "4";
else
InputB.Text += "4";
}
private void Numberbutton5_Click(object sender, EventArgs e)
{
if (IsAOrB == true)
InputA.Text += "5";
else
InputB.Text += "5";
}
private void Numberbutton6_Click(object sender, EventArgs e)
{
if (IsAOrB == true)
InputA.Text += "6";
else
InputB.Text += "6";
}
private void Numberbutton7_Click(object sender, EventArgs e)
{
if (IsAOrB == true)
InputA.Text += "7";
else
InputB.Text += "7";
}
private void Numberbutton8_Click(object sender, EventArgs e)
{
if (IsAOrB == true)
InputA.Text += "8";
else
InputB.Text += "8";
}
private void Numberbutton9_Click(object sender, EventArgs e)
{
if (IsAOrB == true)
InputA.Text += "9";
else
InputB.Text += "9";
}
private void button12_Click(object sender, EventArgs e)
{
if (IsAOrB == true)
InputA.Text += ".";
else
InputB.Text += ".";
}
private void Numberbutton11_Click(object sender, EventArgs e)
{
Double a, b, ResuIt;
a = Convert.ToDouble(InputA.Text);
b = Convert.ToDouble(InputB.Text);
ResuIt = a + b;
InputC.Text = ResuIt.ToString();
}
private void Numberbutton12_Click(object sender, EventArgs e)
{
Double a, b, ResuIt;
a = Convert.ToDouble(InputA.Text);
b = Convert.ToDouble(InputB.Text);
ResuIt = a - b;
InputC.Text = ResuIt.ToString();
}
private void Numberbutton13_Click(object sender, EventArgs e)
{
Double a, b, ResuIt;
a = Convert.ToDouble(InputA.Text);
b = Convert.ToDouble(InputB.Text);
ResuIt = a * b;
InputC.Text = ResuIt.ToString();
}
private void Numberbutton14_Click(object sender, EventArgs e)
{
Double a, b, ResuIt;
a = Convert.ToDouble(InputA.Text);
b = Convert.ToDouble(InputB.Text);
ResuIt = a/b;
InputC.Text = ResuIt.ToString();
}
private void InputA_MouseEnter(object sender, EventArgs e)
{
IsAOrB = true;
}
private void OutpuTB_MouseDown(object sender, MouseEventArgs e)
{
IsAOrB = false;
}
private void Numberbutton17_Click(object sender, EventArgs e)
{
InputA.Text += "";
InputB.Text += "";
InputC.Text += "";
}
}
}