这是大学时候写的计算器,聊以慰藉曾经的青春。

代码如下,有需要可以参考下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace jsq
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void 清空ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.textBox1.Text = "";
            this.comboBox1.Text = "";
            this.textBox2.Text = "";
            this.textBox3.Text = "";
            this.label1.Text = "";
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text == "" || this.textBox2.Text == "")
            {
                MessageBox.Show("你的输入有误!");
            }
            else
            {
                string i = this.comboBox1.SelectedItem.ToString();
                switch (i)
                {
                    case "+": double a = double.Parse(this.textBox1.Text);
                        double b = double.Parse(this.textBox2.Text);
                        double c = a + b;
                        this.textBox3.Text = c.ToString();
                        break;
                    case "-": a = double.Parse(this.textBox1.Text);
                        b = double.Parse(this.textBox2.Text);
                        c = a - b;
                        this.textBox3.Text = c.ToString();
                        break;
                    case "*": a = double.Parse(this.textBox1.Text);
                        b = double.Parse(this.textBox2.Text);
                        c = a * b;
                        this.textBox3.Text = c.ToString();
                        break;
                    case "/": a = double.Parse(this.textBox1.Text);
                        b = double.Parse(this.textBox2.Text);
                        c = a / b;
                        this.textBox3.Text = c.ToString();
                        break;
                }
            }
            this.label2.Text = "  " + this.textBox1.Text + this.comboBox1.Text + this.textBox2.Text + "=" + this.textBox3.Text;
        }
        private void button2_Click(object sender, EventArgs e)
        {
            this.textBox1.Text = "";
            this.comboBox1.Text = "";
            this.textBox2.Text = "";
            this.textBox3.Text = "";
            this.label1.Text = "";
        }
        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }
        private void button3_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }
        private void 帮助ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("               制作:黑色雪               \n\n               时间:7月24日               ");
        }
    }
}
也可以下载自己看:百度云盘链接: https://pan.baidu.com/s/13atC0Ok7VqDwhH55XBMSiw 密码: x6pu


