资源描述:
《c计算器模仿windows计算器》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、Form1:标准型计算器usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceWindowsFormsApplication5{publicpartialclassForm1:Form{stringfh;stringfz;publicDoublea,b;publicdoublec;publicF
2、orm1(){InitializeComponent();}privatevoidForm1_Load(objectsender,EventArgse){}privatevoidbutton1_Click(objectsender,EventArgse){textBox1.Text+=button1.Text;}privatevoidbutton2_Click(objectsender,EventArgse){textBox1.Text+=button2.Text;}privatevoidbutton3_Click(objectsender,EventArgse){textBox1.Tex
3、t+=button3.Text;}privatevoidbutton4_Click(objectsender,EventArgse){textBox1.Text+=button4.Text;}privatevoidbutton5_Click(objectsender,EventArgse){textBox1.Text+=button5.Text;}privatevoidbutton6_Click(objectsender,EventArgse){textBox1.Text+=button6.Text;}privatevoidbutton7_Click(objectsender,EventA
4、rgse){textBox1.Text+=button7.Text;}privatevoidbutton8_Click(objectsender,EventArgse){textBox1.Text+=button8.Text;}privatevoidbutton9_Click(objectsender,EventArgse){textBox1.Text+=button9.Text;}privatevoidbutton10_Click(objectsender,EventArgse){textBox1.Text+=button10.Text;}privatevoidbutton11_Clic
5、k(objectsender,EventArgse){a=Convert.ToDouble(textBox1.Text);fh=button11.Text;textBox1.Text="";}privatevoidbutton12_Click(objectsender,EventArgse){a=Convert.ToDouble(textBox1.Text);fh=button12.Text;textBox1.Text="";}privatevoidbutton13_Click(objectsender,EventArgse){a=Convert.ToDouble(textBox1.Tex
6、t);fh=button13.Text;textBox1.Text="";}privatevoidbutton14_Click(objectsender,EventArgse){a=Convert.ToDouble(textBox1.Text);fh=button14.Text;textBox1.Text="";}privatevoidbutton15_Click(objectsender,EventArgse){b=Convert.ToDouble(textBox1.Text);switch(fh){case"+":textBox1.Text=Convert.ToString(a+b);
7、break;case"-":textBox1.Text=Convert.ToString(a-b);break;case"*":textBox1.Text=Convert.ToString(a*b);break;case"/":textBox1.Text=Convert.ToString(a/b);break;}}privatevoidbutton16_Click(objectsender,EventArgse){tex