C#之WinForm程序设计-简单计算器
在这个小程序中我们需要用到的组件有:
- Button:点击计算
- TextBox:输出要运算的数
- RadioButton:选择运算类型
- GroupBox:绑定RadioButton
首先我们在界面上拖以上的控件,得到如下界面:
这时候监听计算按钮的点击事件:
private void button1_Click(object sender, EventArgs e)
{
double op1, op2, result;
if (textBox1.Text == ""||textB