首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

计算器2-C#窗体

2012-09-14 
计算器2------C#窗体using Systemusing System.Collections.Genericusing System.ComponentModelusing

计算器2------C#窗体

 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms; namespace form1{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        private int  op1, op2, re;        private char op;        private void button2_Click(object sender, EventArgs e)        {            this.textBox1.Text = "";            this.textBox2.Text = "";            this.textBox3.Text = "";        }         private void button1_Click(object sender, EventArgs e)        {            op1 = int.Parse(this.textBox1.Text);            op2 = int.Parse(this.textBox2.Text);             if (radioButton1.Checked == true)            {                re = op1 + op2;                this.textBox3.Text = re.ToString();            }            if (radioButton2.Checked == true)            {                re = op1- op2;                this.textBox3.Text = re.ToString();            }            if (radioButton3.Checked == true)            {                re = op1 * op2;                this.textBox3.Text = re.ToString();            }            if (radioButton4.Checked == true)            {                re = op1 /op2;                this.textBox3.Text = re.ToString();            }        }         private void Form1_Load(object sender, EventArgs e)        {         }    }}

热点排行