📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections;
using System.ComponentModel;
using System.Data;
namespace caculator
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
#region 控件的声明
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem_edi;
private System.Windows.Forms.MenuItem menuItem_cop;
private System.Windows.Forms.MenuItem menuItem_pas;
private System.Windows.Forms.MenuItem menuItem_hel;
private System.Windows.Forms.MenuItem menuItem_hsj;
private System.Windows.Forms.MenuItem menuItem_abt;
private System.Windows.Forms.TextBox txtBox;
private System.Windows.Forms.Button btn_9;
private System.Windows.Forms.Button btn_7;
private System.Windows.Forms.Button btn_8;
private System.Windows.Forms.Button btn_4;
private System.Windows.Forms.Button btn_5;
private System.Windows.Forms.Button btn_6;
private System.Windows.Forms.Button btn_1;
private System.Windows.Forms.Button btn_2;
private System.Windows.Forms.Button btn_3;
private System.Windows.Forms.Button btn_0;
private System.Windows.Forms.Button btn_sign;
private System.Windows.Forms.Button btn_dot;
private System.Windows.Forms.Button btn_eql;
private System.Windows.Forms.Button btn_rev;
private System.Windows.Forms.Button btn_add;
private System.Windows.Forms.Button btn_sqt;
private System.Windows.Forms.Button btn_sub;
private System.Windows.Forms.Button btn_div;
private System.Windows.Forms.Button btn_mul;
private System.Windows.Forms.Button btn_c;
private System.Windows.Forms.Button btn_ce;
private System.Windows.Forms.Button btn_bak;
#endregion
/// <summary>
/// 必需的设计器变量。
/// </summary>
private 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 );
}
#region Windows 窗体设计器生成的代码-窗体的属性和方法
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem_edi = new System.Windows.Forms.MenuItem();
this.menuItem_cop = new System.Windows.Forms.MenuItem();
this.menuItem_pas = new System.Windows.Forms.MenuItem();
this.menuItem_hel = new System.Windows.Forms.MenuItem();
this.menuItem_hsj = new System.Windows.Forms.MenuItem();
this.menuItem_abt = new System.Windows.Forms.MenuItem();
this.txtBox = new System.Windows.Forms.TextBox();
this.btn_7 = new System.Windows.Forms.Button();
this.btn_8 = new System.Windows.Forms.Button();
this.btn_9 = new System.Windows.Forms.Button();
this.btn_4 = new System.Windows.Forms.Button();
this.btn_5 = new System.Windows.Forms.Button();
this.btn_6 = new System.Windows.Forms.Button();
this.btn_1 = new System.Windows.Forms.Button();
this.btn_2 = new System.Windows.Forms.Button();
this.btn_3 = new System.Windows.Forms.Button();
this.btn_0 = new System.Windows.Forms.Button();
this.btn_sign = new System.Windows.Forms.Button();
this.btn_dot = new System.Windows.Forms.Button();
this.btn_eql = new System.Windows.Forms.Button();
this.btn_rev = new System.Windows.Forms.Button();
this.btn_add = new System.Windows.Forms.Button();
this.btn_sqt = new System.Windows.Forms.Button();
this.btn_sub = new System.Windows.Forms.Button();
this.btn_div = new System.Windows.Forms.Button();
this.btn_mul = new System.Windows.Forms.Button();
this.btn_c = new System.Windows.Forms.Button();
this.btn_ce = new System.Windows.Forms.Button();
this.btn_bak = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem_edi,
this.menuItem_hel});
//
// menuItem_edi
//
this.menuItem_edi.Index = 0;
this.menuItem_edi.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem_cop,
this.menuItem_pas});
this.menuItem_edi.Text = "编 辑(&E)";
//
// menuItem_cop
//
this.menuItem_cop.Index = 0;
this.menuItem_cop.Text = "复制(&C)";
this.menuItem_cop.Click += new System.EventHandler(this.menuItem_cop_Click);
//
// menuItem_pas
//
this.menuItem_pas.Index = 1;
this.menuItem_pas.Text = "粘贴(&P)";
this.menuItem_pas.Click += new System.EventHandler(this.menuItem_pas_Click);
//
// menuItem_hel
//
this.menuItem_hel.Index = 1;
this.menuItem_hel.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem_hsj,
this.menuItem_abt});
this.menuItem_hel.Text = "帮 助(&H)";
//
// menuItem_hsj
//
this.menuItem_hsj.Index = 0;
this.menuItem_hsj.Text = "帮助主题(&H)";
this.menuItem_hsj.Click += new System.EventHandler(this.menuItem_hsj_Click);
//
// menuItem_abt
//
this.menuItem_abt.Index = 1;
this.menuItem_abt.Text = "关于计算器(&A)";
this.menuItem_abt.Click += new System.EventHandler(this.menuItem_abt_Click);
//
// txtBox
//
this.txtBox.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.txtBox.Location = new System.Drawing.Point(16, 0);
this.txtBox.Name = "txtBox";
this.txtBox.Size = new System.Drawing.Size(264, 26);
this.txtBox.TabIndex = 0;
this.txtBox.Text = "0.";
this.txtBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.txtBox.TextChanged += new System.EventHandler(this.txtBox_TextChanged);
//
// btn_7
//
this.btn_7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_7.Location = new System.Drawing.Point(16, 88);
this.btn_7.Name = "btn_7";
this.btn_7.Size = new System.Drawing.Size(40, 32);
this.btn_7.TabIndex = 1;
this.btn_7.Tag = "7";
this.btn_7.Text = "7";
this.btn_7.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_8
//
this.btn_8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_8.Location = new System.Drawing.Point(64, 88);
this.btn_8.Name = "btn_8";
this.btn_8.Size = new System.Drawing.Size(40, 32);
this.btn_8.TabIndex = 2;
this.btn_8.Tag = "8";
this.btn_8.Text = "8";
this.btn_8.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_9
//
this.btn_9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_9.Location = new System.Drawing.Point(112, 88);
this.btn_9.Name = "btn_9";
this.btn_9.Size = new System.Drawing.Size(40, 32);
this.btn_9.TabIndex = 3;
this.btn_9.Tag = "9";
this.btn_9.Text = "9";
this.btn_9.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_4
//
this.btn_4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_4.Location = new System.Drawing.Point(16, 128);
this.btn_4.Name = "btn_4";
this.btn_4.Size = new System.Drawing.Size(40, 32);
this.btn_4.TabIndex = 4;
this.btn_4.Tag = "4";
this.btn_4.Text = "4";
this.btn_4.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_5
//
this.btn_5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_5.Location = new System.Drawing.Point(64, 128);
this.btn_5.Name = "btn_5";
this.btn_5.Size = new System.Drawing.Size(40, 32);
this.btn_5.TabIndex = 5;
this.btn_5.Tag = "5";
this.btn_5.Text = "5";
this.btn_5.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_6
//
this.btn_6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_6.Location = new System.Drawing.Point(112, 128);
this.btn_6.Name = "btn_6";
this.btn_6.Size = new System.Drawing.Size(40, 32);
this.btn_6.TabIndex = 6;
this.btn_6.Tag = "6";
this.btn_6.Text = "6";
this.btn_6.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_1
//
this.btn_1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_1.Location = new System.Drawing.Point(16, 168);
this.btn_1.Name = "btn_1";
this.btn_1.Size = new System.Drawing.Size(40, 32);
this.btn_1.TabIndex = 7;
this.btn_1.Tag = "1";
this.btn_1.Text = "1";
this.btn_1.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_2
//
this.btn_2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_2.Location = new System.Drawing.Point(64, 168);
this.btn_2.Name = "btn_2";
this.btn_2.Size = new System.Drawing.Size(40, 32);
this.btn_2.TabIndex = 8;
this.btn_2.Tag = "2";
this.btn_2.Text = "2";
this.btn_2.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_3
//
this.btn_3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_3.Location = new System.Drawing.Point(112, 168);
this.btn_3.Name = "btn_3";
this.btn_3.Size = new System.Drawing.Size(40, 32);
this.btn_3.TabIndex = 9;
this.btn_3.Tag = "3";
this.btn_3.Text = "3";
this.btn_3.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_0
//
this.btn_0.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_0.Location = new System.Drawing.Point(16, 208);
this.btn_0.Name = "btn_0";
this.btn_0.Size = new System.Drawing.Size(40, 32);
this.btn_0.TabIndex = 10;
this.btn_0.Tag = "0";
this.btn_0.Text = "0";
this.btn_0.Click += new System.EventHandler(this.btn_0_Click);
//
// btn_sign
//
this.btn_sign.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_sign.Location = new System.Drawing.Point(64, 208);
this.btn_sign.Name = "btn_sign";
this.btn_sign.Size = new System.Drawing.Size(40, 32);
this.btn_sign.TabIndex = 11;
this.btn_sign.Text = "+/-";
this.btn_sign.Click += new System.EventHandler(this.btn_Oper);
//
// btn_dot
//
this.btn_dot.Font = new System.Drawing.Font("宋体", 22F);
this.btn_dot.Location = new System.Drawing.Point(112, 208);
this.btn_dot.Name = "btn_dot";
this.btn_dot.Size = new System.Drawing.Size(40, 32);
this.btn_dot.TabIndex = 12;
this.btn_dot.Tag = "0";
this.btn_dot.Text = ".";
this.btn_dot.TextAlign = System.Drawing.ContentAlignment.BottomRight;
this.btn_dot.Click += new System.EventHandler(this.btn_Oper);
//
// btn_eql
//
this.btn_eql.Font = new System.Drawing.Font("宋体", 20F, System.Drawing.FontStyle.Bold);
this.btn_eql.Location = new System.Drawing.Point(184, 208);
this.btn_eql.Name = "btn_eql";
this.btn_eql.Size = new System.Drawing.Size(88, 32);
this.btn_eql.TabIndex = 13;
this.btn_eql.Text = "=";
this.btn_eql.Click += new System.EventHandler(this.btn_eql_Click);
//
// btn_rev
//
this.btn_rev.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold);
this.btn_rev.Location = new System.Drawing.Point(184, 168);
this.btn_rev.Name = "btn_rev";
this.btn_rev.Size = new System.Drawing.Size(40, 32);
this.btn_rev.TabIndex = 14;
this.btn_rev.Text = "1/x";
this.btn_rev.Click += new System.EventHandler(this.btn_Oper);
//
// btn_add
//
this.btn_add.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_add.Location = new System.Drawing.Point(232, 168);
this.btn_add.Name = "btn_add";
this.btn_add.Size = new System.Drawing.Size(40, 32);
this.btn_add.TabIndex = 15;
this.btn_add.Text = "+";
this.btn_add.Click += new System.EventHandler(this.btn_Oper);
//
// btn_sqt
//
this.btn_sqt.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btn_sqt.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_sqt.Location = new System.Drawing.Point(184, 128);
this.btn_sqt.Name = "btn_sqt";
this.btn_sqt.Size = new System.Drawing.Size(40, 32);
this.btn_sqt.TabIndex = 16;
this.btn_sqt.Text = "sqt";
this.btn_sqt.Click += new System.EventHandler(this.btn_Oper);
//
// btn_sub
//
this.btn_sub.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold);
this.btn_sub.Location = new System.Drawing.Point(232, 128);
this.btn_sub.Name = "btn_sub";
this.btn_sub.Size = new System.Drawing.Size(40, 32);
this.btn_sub.TabIndex = 17;
this.btn_sub.Text = "-";
this.btn_sub.Click += new System.EventHandler(this.btn_Oper);
//
// btn_div
//
this.btn_div.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_div.Location = new System.Drawing.Point(184, 88);
this.btn_div.Name = "btn_div";
this.btn_div.Size = new System.Drawing.Size(40, 32);
this.btn_div.TabIndex = 18;
this.btn_div.Text = "/";
this.btn_div.Click += new System.EventHandler(this.btn_Oper);
//
// btn_mul
//
this.btn_mul.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_mul.Location = new System.Drawing.Point(232, 88);
this.btn_mul.Name = "btn_mul";
this.btn_mul.Size = new System.Drawing.Size(40, 32);
this.btn_mul.TabIndex = 19;
this.btn_mul.Text = "*";
this.btn_mul.Click += new System.EventHandler(this.btn_Oper);
//
// btn_c
//
this.btn_c.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btn_c.Location = new System.Drawing.Point(192, 40);
this.btn_c.Name = "btn_c";
this.btn_c.Size = new System.Drawing.Size(80, 32);
this.btn_c.TabIndex = 20;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -