缘分啊!
我正在在做这个!
我把自己做的一个代码贴出来给你看吧
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace CalcDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int i = 0;
double x = 0.0;
double y = 0.0;
int z = 0;
int j = 0;
private void IncreaseI()
{
if (i%2 == 0)
{
x = z;
}
else if ( i%2 == 1 )
{
y = z;
}
i++;
if (i > 1)
{
i = 0;
}
textBox1.Text = z.ToString();
}
private void button10_Click(object sender, EventArgs e)
{
z = 0;
IncreaseI();
}
private void button5_Click(object sender, EventArgs e)
{
z = 1;
IncreaseI();
}
private void button7_Click(object sender, EventArgs e)
{
z = 2;
IncreaseI();
}
private void button9_Click(object sender, EventArgs e)
{
z = 3;
IncreaseI();
}
private void button4_Click(object sender, EventArgs e)
{
z = 4;
IncreaseI();
}
private void button6_Click(object sender, EventArgs e)
{
z = 5;
IncreaseI();
}
private void button8_Click(object sender, EventArgs e)
{
z = 6;
IncreaseI();
}
private void button1_Click(object sender, EventArgs e)
{
z = 7;
IncreaseI();
}
private void button2_Click(object sender, EventArgs e)
{
z = 8;
IncreaseI();
}
private void button3_Click(object sender, EventArgs e)
{
z = 9;
IncreaseI();
}
private void button12_Click(object sender, EventArgs e)
{
j = 1;
}
private void button13_Click(object sender, EventArgs e)
{
j = 2;
}
private void button14_Click(object sender, EventArgs e)
{
j = 3;
}
private void button15_Click(object sender, EventArgs e)
{
j = 4;
}
private void button11_Click(object sender, EventArgs e)
{
switch (j)
{
case 1:
textBox1.Text = Convert.ToString(x + y);
break;
case 2:
textBox1.Text = Convert.ToString(x - y);
break;
case 3:
textBox1.Text = Convert.ToString(x * y);
break;
case 4:
textBox1.Text = Convert.ToString(x / y);
break;
default:
break;
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}