国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > C# > 正文

C#實(shí)現(xiàn)Winform版計(jì)算器

2020-01-24 01:09:53
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

本文實(shí)例為大家分享Winform版計(jì)算器的具體實(shí)現(xiàn)方法,供大家參考,具體內(nèi)容如下

前臺(tái)頁(yè)面設(shè)計(jì)

后臺(tái)代碼實(shí)現(xiàn)

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace 計(jì)算器{  public partial class Form1 : Form  {    double c, d;    string m;    public Form1()    {      InitializeComponent();    }    private void button2_Click(object sender, EventArgs e)    {    }    private void button8_Click(object sender, EventArgs e)    {      textBox1.Text += button8.Text;    }    private void button1_Click(object sender, EventArgs e)    {      textBox1.Text += button1.Text;    }    private void button2_Click_1(object sender, EventArgs e)    {      textBox1.Text += button2.Text;    }    private void button3_Click(object sender, EventArgs e)    {      textBox1.Text += button3.Text;    }    private void button4_Click(object sender, EventArgs e)    {      textBox1.Text += button4.Text;    }    private void button5_Click(object sender, EventArgs e)    {      textBox1.Text += button5.Text;    }    private void button6_Click(object sender, EventArgs e)    {      textBox1.Text += button6.Text;    }    private void button7_Click(object sender, EventArgs e)    {      textBox1.Text += button7.Text;    }    private void button9_Click(object sender, EventArgs e)    {      textBox1.Text += button9.Text;    }    private void button10_Click(object sender, EventArgs e)    {      textBox1.Text += button10.Text;    }    private void button15_Click(object sender, EventArgs e)    {      d= Convert.ToDouble(textBox1.Text);      switch (m)      {         case("+"):          textBox1.Text = Convert.ToString(c+d);          break;        case ("-"):          textBox1.Text = Convert.ToString(c-d);          break;        case ("*"):          textBox1.Text = Convert.ToString(c * d);          break;        case ("/"):          textBox1.Text = Convert.ToString(c/d);          break;      }    }    private void button11_Click(object sender, EventArgs e)    {      c = Convert.ToDouble(textBox1.Text);      textBox1.Text = "";      m = button11.Text;    }    private void button12_Click(object sender, EventArgs e)    {      c = Convert.ToDouble(textBox1.Text);      textBox1.Text = "";      m = button12.Text;    }    private void button13_Click(object sender, EventArgs e)    {      c= Convert.ToDouble(textBox1.Text);      textBox1.Text = "";      m = button13.Text;    }    private void button14_Click(object sender, EventArgs e)    {      c = Convert.ToDouble(textBox1.Text);      textBox1.Text = "";      m = button14.Text;    }    private void button16_Click(object sender, EventArgs e)    {      textBox1.Text = "";    }  }}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家學(xué)習(xí)C#程序設(shè)計(jì)有所幫助。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 盐源县| 盐边县| 津南区| 巴楚县| 荆门市| 汪清县| 陈巴尔虎旗| 和政县| 麟游县| 巴彦淖尔市| 麻城市| 怀化市| 那曲县| 丹寨县| 延川县| 康定县| 云梦县| 昌平区| 武鸣县| 鸡西市| 易门县| 金秀| 大悟县| 天祝| 依兰县| 惠州市| 泰来县| 伊春市| 胶州市| 赫章县| 望奎县| 尚义县| 颍上县| 湘乡市| 红安县| 蓝山县| 札达县| 牙克石市| 庆城县| 枞阳县| 德江县|