using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace 计算器
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
#region Windows计算机生成的代码
public System.Windows.Forms.TextBox textBox1;
public System.Windows.Forms.Button button1;
public System.Windows.Forms.Button button2;
public System.Windows.Forms.Button button3;
public System.Windows.Forms.Button button4;
public System.Windows.Forms.Button button5;
public System.Windows.Forms.Button button6;
public System.Windows.Forms.Button button7;
public System.Windows.Forms.Button button8;
public System.Windows.Forms.Button button9;
public System.Windows.Forms.Button button10;
public System.Windows.Forms.Button button11;
public System.Windows.Forms.Button button12;
public System.Windows.Forms.Button button13;
public System.Windows.Forms.Button button14;
public System.Windows.Forms.Button button15;
public System.Windows.Forms.Button button16;
public System.Windows.Forms.GroupBox groupBox1;
public System.Windows.Forms.GroupBox groupBox2;
public System.Windows.Forms.GroupBox groupBox3;
public System.Windows.Forms.GroupBox groupBox4;
public System.Windows.Forms.Button button17;
public System.Windows.Forms.Button button18;
public System.Windows.Forms.Button button19;
public System.Windows.Forms.Button button20;
/// <summary>
/// 必需的设计器变量。
/// </summary>
public System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#endregion
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.button9 = new System.Windows.Forms.Button();
this.button10 = new System.Windows.Forms.Button();
this.button11 = new System.Windows.Forms.Button();
this.button12 = new System.Windows.Forms.Button();
this.button13 = new System.Windows.Forms.Button();
this.button14 = new System.Windows.Forms.Button();
this.button15 = new System.Windows.Forms.Button();
this.button16 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.button20 = new System.Windows.Forms.Button();
this.button19 = new System.Windows.Forms.Button();
this.button18 = new System.Windows.Forms.Button();
this.button17 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(40, 24);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(384, 21);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "";
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// button1
//
this.button1.Location = new System.Drawing.Point(24, 128);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(56, 24);
this.button1.TabIndex = 1;
this.button1.Text = "1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(96, 128);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(56, 24);
this.button2.TabIndex = 2;
this.button2.Text = "2";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(168, 128);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(56, 24);
this.button3.TabIndex = 3;
this.button3.Text = "3";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(24, 80);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(56, 24);
this.button4.TabIndex = 4;
this.button4.Text = "4";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(96, 80);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(56, 24);
this.button5.TabIndex = 5;
this.button5.Text = "5";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button6
//
this.button6.Location = new System.Drawing.Point(168, 80);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(56, 24);
this.button6.TabIndex = 6;
this.button6.Text = "6";
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button7
//
this.button7.Location = new System.Drawing.Point(24, 32);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(56, 24);
this.button7.TabIndex = 7;
this.button7.Text = "7";
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// button8
//
this.button8.Location = new System.Drawing.Point(96, 32);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(56, 24);
this.button8.TabIndex = 8;
this.button8.Text = "8";
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// button9
//
this.button9.Location = new System.Drawing.Point(168, 32);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(56, 24);
this.button9.TabIndex = 9;
this.button9.Text = "9";
this.button9.Click += new System.EventHandler(this.button9_Click);
//
// button10
//
this.button10.Location = new System.Drawing.Point(24, 176);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(64, 24);
this.button10.TabIndex = 10;
this.button10.Text = "0";
this.button10.Click += new System.EventHandler(this.button10_Click);
//
// button11
//
this.button11.Location = new System.Drawing.Point(104, 176);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(40, 24);
this.button11.TabIndex = 11;
this.button11.Text = ".";
//
// button12
//
this.button12.Location = new System.Drawing.Point(160, 176);
this.button12.Name = "button12";
this.button12.Size = new System.Drawing.Size(64, 24);
this.button12.TabIndex = 12;
this.button12.Text = "=";
//
// button13
//
this.button13.Location = new System.Drawing.Point(24, 32);
this.button13.Name = "button13";
this.button13.Size = new System.Drawing.Size(64, 24);
this.button13.TabIndex = 13;
this.button13.Text = "平方";
//
// button14
//
this.button14.Location = new System.Drawing.Point(24, 80);
this.button14.Name = "button14";
this.button14.Size = new System.Drawing.Size(64, 24);
this.button14.TabIndex = 14;
this.button14.Text = "阶乘";
//
// button15
//
this.button15.Location = new System.Drawing.Point(24, 128);
this.button15.Name = "button15";
this.button15.Size = new System.Drawing.Size(64, 24);
this.button15.TabIndex = 15;
this.button15.Text = "求和";
//
// button16
//
this.button16.Location = new System.Drawing.Point(24, 176);
this.button16.Name = "button16";
this.button16.Size = new System.Drawing.Size(64, 24);
this.button16.TabIndex = 16;
this.button16.Text = "求模";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Location = new System.Drawing.Point(16, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(456, 64);
this.groupBox1.TabIndex = 17;
this.groupBox1.TabStop = false;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.button14);
this.groupBox2.Controls.Add(this.button15);
this.groupBox2.Controls.Add(this.button16);
this.groupBox2.Controls.Add(this.button13);
this.groupBox2.Location = new System.Drawing.Point(16, 64);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(112, 232);
this.groupBox2.TabIndex = 18;
this.groupBox2.TabStop = false;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.button7);
this.groupBox3.Controls.Add(this.button8);
this.groupBox3.Controls.Add(this.button9);
this.groupBox3.Controls.Add(this.button4);
this.groupBox3.Controls.Add(this.button1);
this.groupBox3.Controls.Add(this.button10);
this.groupBox3.Controls.Add(this.button5);
this.groupBox3.Controls.Add(this.button2);
this.groupBox3.Controls.Add(this.button11);
this.groupBox3.Controls.Add(this.button6);
this.groupBox3.Controls.Add(this.button3);
this.groupBox3.Controls.Add(this.button12);
this.groupBox3.Location = new System.Drawing.Point(120, 64);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(248, 232);
this.groupBox3.TabIndex = 19;
this.groupBox3.TabStop = false;
//
// groupBox4
//
this.groupBox4.Controls.Add(this.button20);
this.groupBox4.Controls.Add(this.button19);
this.groupBox4.Controls.Add(this.button18);
this.groupBox4.Controls.Add(this.button17);
this.groupBox4.Location = new System.Drawing.Point(360, 64);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(112, 232);
this.groupBox4.TabIndex = 13;
this.groupBox4.TabStop = false;
//
// button20
//
this.button20.Location = new System.Drawing.Point(32, 176);
this.button20.Name = "button20";
this.button20.Size = new System.Drawing.Size(56, 24);
this.button20.TabIndex = 5;
this.button20.Text = "÷";
//
// button19
//
this.button19.Location = new System.Drawing.Point(32, 128);
this.button19.Name = "button19";
this.button19.Size = new System.Drawing.Size(56, 24);
this.button19.TabIndex = 4;
this.button19.Text = "×";
//
// button18
//
this.button18.Location = new System.Drawing.Point(32, 80);
this.button18.Name = "button18";
this.button18.Size = new System.Drawing.Size(56, 24);
this.button18.TabIndex = 3;
this.button18.Text = "-";
//
// button17
//
this.button17.Location = new System.Drawing.Point(32, 32);
this.button17.Name = "button17";
this.button17.Size = new System.Drawing.Size(56, 24);
this.button17.TabIndex = 2;
this.button17.Text = "+";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(488, 334);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.Text = "计算器 作者:董格格【http://donggege.cnblog,com】";
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
#region 显示
public void textBox1_TextChanged(string number)
{
textBox1.Text=number;
}
#endregion
#region 数字按钮的反应代码
public void button7_Click(object sender, System.EventArgs e)
{
textBox1_TextChanged(this.button7.Text);
NumberChange(this.button7.Text);
}
public void button10_Click(object sender, System.EventArgs e)
{
textBox1_TextChanged(this.button10.Text);
}
public void button1_Click(object sender, System.EventArgs e)
{
textBox1_TextChanged(this.button1.Text);
}
public void button2_Click(object sender, System.EventArgs e)
{
textBox1_TextChanged(this.button2.Text);
}
public void button3_Click(object sender, System.EventArgs e)
{
textBox1_TextChanged(this.button3.Text);
}
public void button4_Click(object sender, System.EventArgs e)
{
textBox1_TextChanged(this.button4.Text);
}
public void button5_Click(object sender, System.EventArgs e)
{
textBox1_TextChanged(this.button5.Text);
}
public void button6_Click(object sender, System.EventArgs e)
{
textBox1_TextChanged(this.button6.Text);
}
public void button8_Click(object sender, System.EventArgs e)
{
textBox1_TextChanged(this.button8.Text);
}
public void button9_Click(object sender, System.EventArgs e)
{
textBox1_TextChanged(this.button9.Text);
}
#endregion
#region 运算结果
public string NumberChange(string number)
{
if(number!=)
textBox1_TextChanged
}
#endregion
# region 数字控制
/* public int NumberControl(int i,string s)
{
int m;
m =(int)(int.Parse( s ));
i = 10 * i + m;
*/
}
#endregion
}