如图,计算器界面如下
使用方法
在两个文本框输入数字后,点击“加减乘除”号,最后一个文本框实时显示结果。
源码如下
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "" || textBox2.Text == "") { MessageBox.Show("请输入数字后点击+号", "提示", MessageBoxButtons.OK); }else {